import chalk from 'chalk'
-import semVer from 'semver'
+import { satisfies } from 'semver'
import packageJson from './package.json' assert { type: 'json' }
import { version, exit } from 'node:process'
*/
export const checkNodeVersion = () => {
const enginesNodeVersion = packageJson.engines.node
- if (semVer.satisfies(version, enginesNodeVersion) === false) {
+ if (satisfies(version, enginesNodeVersion) === false) {
console.error(
chalk.red(
`Required node version ${enginesNodeVersion} not satisfied with current version ${version}`
"@mikro-orm/cli": "^6.1.3",
"@release-it/bumper": "^6.0.1",
"@types/node": "^20.11.17",
+ "@types/semver": "^7.5.7",
"@types/tar": "^6.1.11",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.0.1",
+import { version } from 'node:process'
import { describe, it } from 'node:test'
import { hoursToMilliseconds, hoursToSeconds } from 'date-fns'
import { expect } from 'expect'
+import { satisfies } from 'semver'
import { Constants } from '../../src/utils/Constants.js'
import {
const date = new Date()
expect(clone(date)).toStrictEqual(date)
expect(clone(date) === date).toBe(false)
- // The URL object seems to have not enumerable properties
- const url = new URL('https://domain.tld')
- expect(clone(url)).toStrictEqual({})
+ if (satisfies(version, '>=21.0.0')) {
+ const url = new URL('https://domain.tld')
+ expect(() => clone(url)).toThrowError(new Error('Cannot clone object of unsupported type.'))
+ }
const map = new Map([['1', '2']])
expect(clone(map)).toStrictEqual(map)
expect(clone(map) === map).toBe(false)
expect(clone(set)).toStrictEqual(set)
expect(clone(set) === set).toBe(false)
const weakMap = new WeakMap([[{ 1: 1 }, { 2: 2 }]])
- expect(() => clone(weakMap)).toThrow(new Error('#<WeakMap> could not be cloned.'))
+ expect(() => clone(weakMap)).toThrowError(new Error('#<WeakMap> could not be cloned.'))
const weakSet = new WeakSet([{ 1: 1 }, { 2: 2 }])
- expect(() => clone(weakSet)).toThrow(new Error('#<WeakSet> could not be cloned.'))
+ expect(() => clone(weakSet)).toThrowError(new Error('#<WeakSet> could not be cloned.'))
})
await it('Verify hasOwnProp()', () => {