Commit Graph
419 Commits
Author SHA1 Message Date
Jihwan 8465148f4a test_runner: fix env option validation
Signed-off-by: hanityx <hanityx@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64865
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-08-04 18:32:44 +00:00
avivkeller b7d29fee74 test_runner: add support for --test-coverage-include-all
Signed-off-by: avivkeller <me@aviv.sh>
PR-URL: https://github.com/nodejs/node/pull/64830
Fixes: https://github.com/nodejs/node/issues/58887
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-07-31 15:58:10 -07:00
semimikoh 853358e70f test_runner: wait for filtered suite build
Signed-off-by: semimikoh <ejffjeosms@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64208
Fixes: https://github.com/nodejs/node/issues/64203
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-07-29 01:32:55 +00:00
Aviv Keller 1ba3ce45bf test_runner: convert to uint during deserialization
Signed-off-by: Aviv Keller <me@aviv.sh>
PR-URL: https://github.com/nodejs/node/pull/64706
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-07-26 05:17:40 +00:00
Livia Medeirosandlouiellan 727e2bce8e lib,tools: add node-core/func-name-matching lint rule
And rename functions accordingly.

Signed-off-by: LiviaMedeiros <livia@cirno.name>
Co-authored-by: louiellan <louie.lou.llaneta@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57901
Refs: https://github.com/nodejs/node/issues/57899
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2026-07-14 15:30:56 +02:00
Moshe Atlow 892976d17a test_runner: add context.log() and test:log event
Add a log(message[, data]) method to TestContext and SuiteContext that
emits a new test:log event. Unlike test:diagnostic, which is buffered
so it is emitted in the order tests are defined, test:log is emitted
immediately, in the order tests execute, including under process
isolation where it bypasses the per-file declaration order buffer.
This gives reporters that render the test tree unbuffered a live,
attributed logging channel that captured stdout cannot provide under
concurrency.

The event carries the message, an optional opaque structured payload
that the runner passes through untouched, and the emitting test's
name, testId, parentId, nesting, and location. Built-in reporters
render it the same way they render test:diagnostic.

Signed-off-by: Moses Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/64389
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-07-12 11:45:05 +00:00
Moshe Atlow f4c85d5d82 test_runner: report entryFile in TestStream events
Signed-off-by: Moshe Atlov <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/64309
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-07-07 15:29:21 +00:00
Antoine du Hamel dc15da3df5 lib: use __proto__: null when calling ObjectDefineProperty
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64239
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
2026-07-03 18:25:34 +00:00
Trivikram Kamat 242f2e7c5b test_runner: filter execArgv fallback for child tests
Apply the test runner propagation filter to execArgv entries that are
not reported by the options binding. This prevents config-file and
test-runner flags from leaking into isolated child tests while still
preserving V8 flags.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64056
Refs: https://github.com/nodejs/reliability/issues?q=%22test-runner-flag-propagation%22
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-06-29 07:04:46 +00:00
Trivikram Kamat 266e1658b0 test_runner: improve coverage failure diagnostics
Include the coverage filename when parsing V8 coverage data fails,
and make test-runner coverage assertions report spawned child process
output when the expected coverage report is missing.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/64050
Refs: https://github.com/nodejs/reliability/issues?q=%22parallel%2Ftest-runner-coverage%22
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-06-23 22:06:23 +00:00
sangwook 546b5967f9 test_runner: add timestamp to JUnit reporter testsuites
Emit the standard JUnit timestamp (ISO 8601) on <testsuite> elements,
which the reporter was omitting. The suite start time is reconstructed
as end-minus-duration, because the runner reports a suite's test:start
lazily (when its first subtest reports), which would otherwise record a
time close to the suite's end.

Fixes: https://github.com/nodejs/node/issues/64028
Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64029
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-06-22 15:42:03 +00:00
Daijiro Wachi b3042c7b68 test_runner: remove unused shuffleArrayWithSeed
shuffleArrayWithSeed was introduced along with test order
randomization but was never called: the feature picks a random
pending subtest at dequeue time using createSeededGenerator
directly. Remove the dead helper and its export, and add direct
unit coverage for createSeededGenerator's deterministic contract.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63847
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2026-06-13 09:02:10 +00:00
Trivikram Kamat 45c7071b4a test_runner: fix watch cwd with isolation none
When watch mode runs with isolation disabled, spawn the child test
runner with the files or glob patterns from the current run instead
of reusing the parent process argv.

This keeps discovery scoped to the configured cwd and avoids rerunning
the driver test when the parent argv points outside that cwd.

Fixes: https://github.com/nodejs/node/issues/63689

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: https://github.com/nodejs/node/pull/63690
Fixes: https://github.com/nodejs/node/issues/63689
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-06-01.md#jstest-failure
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-06-08 06:56:20 +00:00
sangwook 75b16f1f4e test_runner: avoid recompiling coverage globs for every file
`shouldSkipFileCoverage()` called `matchGlobPattern()` for each covered
file, and `matchGlobPattern()` builds a fresh Minimatch (a full glob
parse and regexp compile) on every call. The coverage exclude/include
globs never change during a run, so the same patterns were recompiled
once per file, which dominated the coverage report time.

Compile `coverageExcludeGlobs`/`coverageIncludeGlobs` to matchers once
per `TestCoverage` instance and reuse them for every file. Expose
`createMatcher()` from `internal/fs/glob` for this.

On a synthetic 200-test-file project this drops shouldSkipFileCoverage
from ~117ms to ~11ms (cpu-prof, isolation=none); the saving scales with
files * globs.

Refs: https://github.com/nodejs/node/issues/55103
Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63675
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-06-02 14:44:23 +02:00
sangwook 29aad20aa6 test_runner: cache shouldSkipFileCoverage result per URL
`shouldSkipFileCoverage(url)` is invoked twice for every covered
script (once during source-map mapping and once during merge), and
the same script URL is typically reported by every worker. The
result depends only on `options.cwd`, `coverageExcludeGlobs`, and
`coverageIncludeGlobs`, all of which are fixed for the lifetime of
a TestCoverage instance, so the URL -> boolean mapping is
deterministic and safe to cache.

Add a private `#skipCache` SafeMap and split the method into a thin
caching wrapper plus a private `#computeShouldSkipFileCoverage`
that holds the original logic. Callers are unchanged.

This eliminates redundant glob and URL parsing work proportional to
the number of workers x scripts in the coverage report.

Refs: https://github.com/nodejs/node/issues/55103
Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63675
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-06-02 14:44:21 +02:00
Matteo Collina 8d0a3b84ff test_runner: ignore erased TS lines in coverage
Fixes: https://github.com/nodejs/node/issues/54753
Signed-off-by: Matteo Collina <matteo.collina@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63510
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-05-28 07:47:24 +00:00
Moshe Atlow cebe4248af test_runner: fix suite diagnostic chanel end
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63533
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
2026-05-26 13:41:29 +00:00
Moshe Atlow 1ddb754d39 test_runner: dont buffer unordered events in process isolation mode
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63432
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-05-24 19:48:42 +00:00
atlowChemi 74ccf384a9 test_runner: fix --test-rerun-failures swallowing failures on retry
Three independent bugs interacted to let a real failure-on-retry be
reported as a pass:

1. The runner's disambiguator stored the counter against the suffixed
   identifier (after mutation) instead of the base key, so the counter
   never advanced past 1 and every 3rd+ same-loc registration collided
   on :(1).
2. The reporter had the same off-by-one when writing the state file.
3. The reporter only bumped its counter on `test:pass`, so any failing
   test at a shared source location desynchronised the writer and
   runner counters - on retry, the surviving failing sibling would
   inherit a slot that in the previous attempt belonged to a different
   (passing) sibling. Node matched by that slot, replaced `this.fn`
   with a synthetic noop replay, and reported the failure as a pass.

Track the base identifier separately in the runner, bump the counter
against the base key in both the runner and the reporter, and bump the
reporter's counter on `test:fail` in addition to `test:pass`.

Fixes: https://github.com/nodejs/node/issues/63424
Signed-off-by: atlowChemi <chemi@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63431
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-05-24 10:29:56 +03:00
sangwook c9dbb86683 inspector: expose precise coverage start to JS runtime
Add a `startCoverage` method on the `profiler` internal binding so
that V8 precise coverage can be enabled after bootstrap. The method
is idempotent against the existing bootstrap path (which creates a
V8CoverageConnection when NODE_V8_COVERAGE or
--experimental-test-coverage is set) and a no-op when the inspector
is unavailable, e.g. in the parent process of
`--test --test-isolation=process` where workers handle coverage and
Environment::should_create_inspector() returns false.

Refs: https://github.com/nodejs/node/issues/60023
Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/63079
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-05-23 17:02:02 +00:00
Moshe Atlow e6e670015c test_runner: add parentId to test events with testId
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63435
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-05-21 16:06:26 +00:00
Moshe Atlow 5c870129cc test_runner: show replayed-from-attempt hint in spec reporter
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63429
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-05-21 11:39:14 +00:00
Moshe Atlow 145527738b test_runner: preserve run duration when using test-rerun
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63429
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-05-21 11:39:13 +00:00
Ali Hassan debe2ed2ef test_runner: avoid hanging on incomplete v8 frames
Signed-off-by: Ali Hassan <ali-hassan27@outlook.com>
PR-URL: https://github.com/nodejs/node/pull/62704
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-05-18 07:54:35 +00:00
Moshe Atlow 57508024c3 test_runner: fix hooks test context
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63285
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2026-05-15 10:46:21 +00:00
Moshe Atlow fa1e1f4fd4 test_runner: fix diagnostics channel context tracking
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63283
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-05-15 10:46:09 +00:00
Chemi Atlow b06aee06d3 test_runner: add tags option and tag-name filter
Adds a `tags` option to test(), it(), suite(), and describe() that
accepts an array of string labels. Tags are canonicalized to lowercase
and inherited from suites to nested tests by union. Reporter events
expose the tag set on every test, and TestContext exposes the test's
tags via `context.tags`.

Filtering is done by literal tag name through the new
`--experimental-test-tag-filter=<tag>` flag (or `testTagFilters` on
run()). The flag may be specified more than once; tests must contain
every filter to run. Untagged tests are excluded under any positive
filter.

The tagging mechanism is gated behind a one-shot ExperimentalWarning.

Signed-off-by: atlowChemi <chemi@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63221
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
2026-05-12 06:51:19 +00:00
Joyee Cheung 4f44c6f5fe module: fix sync hook short-circuit in require() in imported CJS
- For imported CJS, if it's not customized by asynchronous hooks,
  make sure it won't use the quirky re-invented require in all
  cases.
- When the imported CJS module is customized by synchronous hooks,
  in the synthetic module evalutation step, avoid calling the
  respective default step again.
- Make the branching of loadCJSModuleWithModuleLoad() and
  loadCJSModuleWithSpecialRequire() more explicit, and fold
  the tentative fs read in the 'commonjs' translator into the
  share createCJSModuleWrap() helper instead of checking it
  twice in the same path.

Signed-off-by: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62920
Fixes: https://github.com/nodejs/node/issues/63060
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
2026-05-07 14:44:56 +00:00
Moshe Atlow 480ee085f2 test_runner: fix failing suite hooks when marked with todo
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/63097
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
2026-05-05 09:22:14 +00:00
sangwook a5b3d76f80 test_runner: align mock timeout api
Expose Timeout.close() and Timeout[Symbol.dispose]() from MockTimers.

This keeps fake setTimeout() handles aligned with the public
Timeout API so disposal-based patterns do not throw.

Add targeted coverage for Timeout.close() and
Timeout[Symbol.dispose]().

Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62820
Fixes: https://github.com/nodejs/node/issues/62815
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-04-23 21:45:57 +00:00
Moshe Atlow 633b9635b8 test_runner: fix suite rerun edge case
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/62860
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-04-23 08:36:04 +00:00
DeveloperViraj d1ac02f841 test_runner: add mock-timers support for AbortSignal.timeout
PR-URL: https://github.com/nodejs/node/pull/60751
Fixes: https://github.com/nodejs/node/issues/60509
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-04-22 22:18:48 +02:00
Moshe Atlow 31b9e60979 test_runner: add testId to test events
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/62772
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2026-04-18 10:10:56 +00:00
Marco Ippolito 2071c44630 src: allow empty --experimental-config-file
PR-URL: https://github.com/nodejs/node/pull/61610
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-04-16 06:31:35 +00:00
Moshe Atlow c7d05fc0d3 test_runner: publish to TracingChannel for OTel instrumentation
Signed-off-by: Moshe Atlow <moshe@atlow.co.il>
PR-URL: https://github.com/nodejs/node/pull/62502
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-04-13 15:01:34 +03:00
Pietro Marchini 5ff1eab951 test_runner: support test order randomization
PR-URL: https://github.com/nodejs/node/pull/61747
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-04-02 16:55:11 +00:00
Moshe Atlow cdc577484b test_runner: add passed, attempt, and diagnostic to SuiteContext
PR-URL: https://github.com/nodejs/node/pull/62504
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-04-01 11:29:56 +00:00
Moshe Atlow c5a83ab77c test_runner: add getTestContext()
PR-URL: https://github.com/nodejs/node/pull/62501
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-04-01 10:09:41 +00:00
sangwook 7d1f1b4483 test_runner: add exports option for module mocks
Add options.exports support in mock.module() and normalize option

shapes through a shared exports path.

Keep defaultExport and namedExports as aliases, emit runtime

deprecation warnings for legacy options, and update docs and tests,

including output fixtures and coverage snapshots.

Refs: https://github.com/nodejs/node/issues/58443
PR-URL: https://github.com/nodejs/node/pull/61727
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-03-27 15:52:13 +00:00
Matteo Collina 8199f9c9d9 test_runner: make it compatible with fake timers
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/59272
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
2026-03-22 13:07:26 +00:00
Edy Silva f68824a680 test_runner: set non-zero exit code when suite errors occur
PR-URL: https://github.com/nodejs/node/pull/62282
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2026-03-18 17:09:42 +00:00
Igor Shevelenkov 2ae6d8f2d6 test_runner: run afterEach on runtime skip
Signed-off-by: Igor <igorshevelenkov4@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/61525
Fixes: https://github.com/nodejs/node/issues/61462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-02-26 21:36:23 +00:00
sangwook 2e1265a444 test_runner: expose expectFailure message
This change exposes the expectFailure message in the test runner and
adds edge cases for expectFailure ambiguity.

PR-URL: https://github.com/nodejs/node/pull/61563
Fixes: https://github.com/nodejs/node/issues/61570
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-02-26 15:37:55 +00:00
Ali Hassan 2ebe49600e test_runner: expose worker ID for concurrent test execution
This adds support for identifying which worker is running a test file
when tests execute concurrently, similar to JEST_WORKER_ID in Jest,
VITEST_POOL_ID in Vitest, and MOCHA_WORKER_ID in Mocha.

When running with --test-isolation=process (default), each test file
runs in a separate child process and receives a unique worker ID from
1 to N. When running with --test-isolation=none, all tests run in the
same process and the worker ID is always 1.

This enables users to allocate separate resources (databases, ports,
etc.) for each test worker to avoid conflicts during concurrent
execution.

Changes:
- Add WorkerIdPool class to manage worker ID allocation and reuse
- Set NODE_TEST_WORKER_ID environment variable for child processes
- Add context.workerId getter to TestContext class
- Add tests for worker ID functionality
- Add documentation for context.workerId

Fixes: https://github.com/nodejs/node/issues/55842
PR-URL: https://github.com/nodejs/node/pull/61394
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
2026-02-24 23:37:22 +00:00
Ayoub Mabrouk 14aaf4e38b test_runner: replace native methods with primordials
Replace native methods with primordials.

PR-URL: https://github.com/nodejs/node/pull/61219
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2026-02-24 22:02:18 +00:00
Matteo Collina 7215ea428c test_runner: show interrupted test on SIGINT
When the test runner process is killed with SIGINT (Ctrl+C), display
which test was running at the time of interruption. This makes it
easier to identify tests that hang or take too long.

- Add `test:interrupted` event emitted when SIGINT is received
- Add `interrupted()` method to TestsStream
- Handle the event in both TAP and spec reporters
- TAP outputs: `# Interrupted while running: <test>`
- Spec outputs with yellow header and warning symbol
- Use setImmediate to allow reporter stream to flush before exit

With process isolation (default), shows the file path since the
parent runner only knows about file-level tests.
With --test-isolation=none, shows the actual test name.

PR-URL: https://github.com/nodejs/node/pull/61676
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-02-14 16:29:52 +00:00
Moshe Atlow e687680457 test_runner: fix suite rerun
PR-URL: https://github.com/nodejs/node/pull/61775
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-02-13 14:31:09 +00:00
Edy Silva 61a4a30e0e test_runner: fix test enqueue when test file has syntax error
PR-URL: https://github.com/nodejs/node/pull/61573
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-02-02 16:57:37 +00:00
Moshe Atlow ea83d326f7 test_runner: fix passing expectFailure
PR-URL: https://github.com/nodejs/node/pull/61568
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
2026-01-30 17:41:45 +00:00
Moshe Atlow db036286af test_runner: differentiate todo and failure styles
PR-URL: https://github.com/nodejs/node/pull/61564
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
2026-01-30 15:51:08 +00:00