node/test/test-runner/test-run-watch-run-duration.mjs
Joyee Cheung ea1a240633
test: split test-runner-run-watch.mjs
This test contains too many independent test cases and as a
result, marking it as flaky on all major platforms means
actual regressions could be covered up, and it's constantly
making the CI orange and requires extra resuming on the
flaked platforms which is still not great. Split it into
individual files so that the actual flake can be identified
out of the monolith.

PR-URL: https://github.com/nodejs/node/pull/60653
Refs: https://github.com/nodejs/node/issues/54534
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-11-11 10:36:52 +00:00

20 lines
874 B
JavaScript

// Test run({ watch: true }) recalculates the run duration on a watch restart
// This test is flaky by its nature as it relies on the timing of 2 different runs
// considering the number of digits in the duration_ms is 9
// the chances of having the same duration_ms are very low
// but not impossible
// In case of costant failures, consider increasing the number of tests
import '../common/index.mjs';
import assert from 'node:assert';
import { skipIfNoWatch, refreshForTestRunnerWatch, testRunnerWatch } from '../common/watch.js';
skipIfNoWatch();
refreshForTestRunnerWatch();
const testRuns = await testRunnerWatch({ file: 'test.js', fileToUpdate: 'test.js', useRunApi: true });
const durations = testRuns.map((run) => {
const runDuration = run.match(/# duration_ms\s([\d.]+)/);
return runDuration;
});
assert.notDeepStrictEqual(durations[0][1], durations[1][1]);