mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
This test has been timing out in the CI with no information about why. Splitting it into multiple files to at least show which test case is timing out. Drive-by: name the test as test-watch-mode-kill-signal-* as the tests aren't testing the test runner and are just testing --watch-kill-signal. PR-URL: https://github.com/nodejs/node/pull/60298 Refs: https://github.com/nodejs/node/issues/60297 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
// Test that --watch-kill-signal errors when an invalid kill signal is provided.
|
|
|
|
import '../common/index.mjs';
|
|
import assert from 'node:assert';
|
|
import { writeFileSync } from 'node:fs';
|
|
import { spawn } from 'node:child_process';
|
|
import tmpdir from '../common/tmpdir.js';
|
|
import fixtures from '../common/fixtures.js';
|
|
import { skipIfNoWatchModeSignals } from '../common/watch.js';
|
|
|
|
skipIfNoWatchModeSignals();
|
|
|
|
tmpdir.refresh();
|
|
const indexPath = tmpdir.resolve('kill-signal-for-watch.js');
|
|
const indexContents = fixtures.readSync('kill-signal-for-watch.js', 'utf8');
|
|
writeFileSync(indexPath, indexContents);
|
|
|
|
const currentRun = Promise.withResolvers();
|
|
const child = spawn(
|
|
process.execPath,
|
|
['--watch', '--watch-kill-signal', 'invalid_signal', indexPath],
|
|
{
|
|
cwd: tmpdir.path,
|
|
stdio: ['inherit', 'inherit', 'pipe'],
|
|
}
|
|
);
|
|
let stderr = '';
|
|
|
|
child.stderr.on('data', (data) => {
|
|
stderr += data.toString();
|
|
currentRun.resolve();
|
|
});
|
|
|
|
await currentRun.promise;
|
|
|
|
assert.match(
|
|
stderr,
|
|
/TypeError \[ERR_UNKNOWN_SIGNAL\]: Unknown signal: invalid_signal/
|
|
);
|