From bc427640181e35f350d4f9d0384b1e87124c1004 Mon Sep 17 00:00:00 2001 From: Nikita Skovoroda Date: Tue, 16 Jul 2024 05:14:48 +0300 Subject: [PATCH] all valid Node.js versions have --watch support --- bin/index.js | 7 ++----- src/version.js | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/index.js b/bin/index.js index bc3606f..153aa8c 100755 --- a/bin/index.js +++ b/bin/index.js @@ -6,7 +6,7 @@ import { basename, dirname, resolve } from 'node:path' import { createRequire } from 'node:module' import assert from 'node:assert/strict' import glob from 'fast-glob' -import { haveModuleMocks, haveSnapshots, haveForceExit, haveWatch } from '../src/version.js' +import { haveModuleMocks, haveSnapshots, haveForceExit } from '../src/version.js' const bindir = dirname(fileURLToPath(import.meta.url)) @@ -119,10 +119,7 @@ if (options.forceExit) { args.push('--test-force-exit') } -if (options.watch) { - assert(haveWatch, 'For watch mode, use Node.js >= 18.13.0') - args.push('--watch') -} +if (options.watch) args.push('--watch') args.push('--expose-internals') // this is unoptimal and hopefully temporary, see rationale in src/dark.cjs diff --git a/src/version.js b/src/version.js index 29dfd74..87f364f 100644 --- a/src/version.js +++ b/src/version.js @@ -11,6 +11,5 @@ export { major, minor, patch } export const haveModuleMocks = (major === 22 && minor >= 3) || major > 22 export const haveSnapshots = (major === 22 && minor >= 3) || major > 22 export const haveForceExit = (major === 20 && minor > 13) || major >= 22 -export const haveWatch = (major === 18 && minor > 13) || major >= 20 export const haveValidTimers = (major === 20 && minor >= 11) || major >= 22 // older glitch in various ways / stop executing export const haveNoTimerInfiniteLoopBug = (major === 20 && minor >= 11) || major >= 22 // mock.timers.runAll() can get into infinite recursion