From 641af8ea0d5331ee18df33c2d83337c5f91c97de Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Thu, 3 Aug 2023 22:51:59 +0300 Subject: [PATCH 1/3] test_runner: add multiple files benchmark --- benchmark/test_runner/multi-files.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 benchmark/test_runner/multi-files.js diff --git a/benchmark/test_runner/multi-files.js b/benchmark/test_runner/multi-files.js new file mode 100644 index 00000000000000..83c8f11b460804 --- /dev/null +++ b/benchmark/test_runner/multi-files.js @@ -0,0 +1,27 @@ +'use strict'; +const common = require('../common'); + +const bench = common.createBenchmark(main, { + patterns: ['test/fixtures/test-runner/**/*.?(c|m)js', 'test/parallel/test-runner-*'], + concurrency: ['yes', 'no'], +}, { + flags: ['--expose-internals'], +}); + + +function main({ patterns, concurrency }) { + const { run } = require('node:test'); + const { Glob } = require('internal/fs/glob'); + const glob = new Glob([patterns]); + const files = glob.globSync().filter((f) => !f.includes('never_ending') && !f.includes('watch-mode')); + concurrency = concurrency === 'yes'; + let tests = 0; + + bench.start(); + (async function() { + const stream = run({ concurrency, files }); + for await (const { type } of stream) { + if (type === 'test:start') tests++; + } + })().then(() => bench.end(tests)); +} From 4a7375ffe5ae572ce6ca6f24253219d14a36399f Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Wed, 26 Jul 2023 08:55:45 +0300 Subject: [PATCH 2/3] test_runner: dequeue concurrently --- lib/internal/test_runner/test.js | 20 ++++++------ .../output/default_output.snapshot | 4 +++ .../test-runner/output/describe_it.snapshot | 16 ++++++++-- .../test-runner/output/hooks.snapshot | 10 ++++-- .../output/junit_reporter.snapshot | 31 ++++++++++++------- .../test-runner/output/output.snapshot | 9 ++++++ .../test-runner/output/output_cli.snapshot | 9 ++++++ .../test-runner/output/spec_reporter.snapshot | 18 +++++++++++ .../output/spec_reporter_cli.snapshot | 18 +++++++++++ 9 files changed, 108 insertions(+), 27 deletions(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 4afb93f4a60df0..083cb2a94a88df 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -366,13 +366,11 @@ class Test extends AsyncResource { ArrayPrototypePush(this.pendingSubtests, deferred); } - async processPendingSubtests() { + processPendingSubtests() { while (this.pendingSubtests.length > 0 && this.hasConcurrency()) { const deferred = ArrayPrototypeShift(this.pendingSubtests); const test = deferred.test; - this.reporter.dequeue(test.nesting, test.loc, test.name); - await test.run(); - deferred.resolve(); + PromisePrototypeThen(test.dequeue(), deferred.resolve); } } @@ -525,6 +523,12 @@ class Test extends AsyncResource { ArrayPrototypePush(this.diagnostics, message); } + dequeue() { + this.reporter.dequeue(this.nesting, this.loc, this.name); + this.parent.activeSubtests++; + return this.run(); + } + start() { // If there is enough available concurrency to run the test now, then do // it. Otherwise, return a Promise to the caller and mark the test as @@ -537,9 +541,7 @@ class Test extends AsyncResource { this.parent.addPendingSubtest(deferred); return deferred.promise; } - - this.reporter.dequeue(this.nesting, this.loc, this.name); - return this.run(); + return this.dequeue(); } [kShouldAbort]() { @@ -575,9 +577,6 @@ class Test extends AsyncResource { } async run() { - if (this.parent !== null) { - this.parent.activeSubtests++; - } this.startTime = hrtime(); if (this[kShouldAbort]()) { @@ -925,7 +924,6 @@ class Suite extends Test { let stopPromise; try { - this.parent.activeSubtests++; await this.buildSuite; this.startTime = hrtime(); diff --git a/test/fixtures/test-runner/output/default_output.snapshot b/test/fixtures/test-runner/output/default_output.snapshot index b003f9299c4418..5a159cc37b1812 100644 --- a/test/fixtures/test-runner/output/default_output.snapshot +++ b/test/fixtures/test-runner/output/default_output.snapshot @@ -8,6 +8,7 @@ *[39m *[39m *[39m + *[39m [90m﹣ should skip [90m(*ms)[39m # SKIP[39m ▶ parent @@ -18,6 +19,7 @@ *[39m *[39m *[39m + *[39m [31m✖ should pass but parent fail [90m(*ms)[39m[39m [32m'test did not finish before its parent and was cancelled'[39m @@ -45,6 +47,7 @@ *[39m *[39m *[39m + *[39m * [31m✖ should fail [90m(*ms)[39m[39m @@ -54,6 +57,7 @@ *[39m *[39m *[39m + *[39m * [31m✖ should pass but parent fail [90m(*ms)[39m[39m diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot index be345f11575c8d..ced1d9b03c7a6f 100644 --- a/test/fixtures/test-runner/output/describe_it.snapshot +++ b/test/fixtures/test-runner/output/describe_it.snapshot @@ -25,6 +25,7 @@ not ok 3 - sync todo # TODO * * * + * ... # Subtest: sync todo with message not ok 4 - sync todo with message # TODO this is a failing todo @@ -42,6 +43,7 @@ not ok 4 - sync todo with message # TODO this is a failing todo * * * + * ... # Subtest: sync skip pass ok 5 - sync skip pass # SKIP @@ -74,6 +76,7 @@ not ok 8 - sync throw fail * * * + * ... # Subtest: async skip pass ok 9 - async skip pass # SKIP @@ -106,6 +109,7 @@ not ok 12 - async throw fail * * * + * ... # Subtest: async skip fail not ok 13 - async skip fail # SKIP @@ -140,6 +144,7 @@ not ok 14 - async assertion fail * * * + * ... # Subtest: resolve pass ok 15 - resolve pass @@ -162,6 +167,7 @@ not ok 16 - reject fail * * * + * ... # Subtest: unhandled rejection - passes but warns ok 17 - unhandled rejection - passes but warns @@ -204,10 +210,10 @@ ok 21 - immediate resolve pass * * * + * new Promise () * * - Array.map () ... # Subtest: mixing describe/it and test should work ok 2 - mixing describe/it and test should work @@ -292,6 +298,7 @@ not ok 28 - sync skip option is false fail * * * + * ... # Subtest: ok 29 - @@ -390,6 +397,7 @@ not ok 43 - callback throw * * * + * ... # Subtest: callback called twice not ok 44 - callback called twice @@ -474,10 +482,10 @@ not ok 50 - custom inspect symbol that throws fail * * * + * new Promise () * * - Array.map () ... # Subtest: sync throw fails at second not ok 2 - sync throw fails at second @@ -497,7 +505,7 @@ not ok 50 - custom inspect symbol that throws fail * * * - async Promise.all (index 0) + * ... 1..2 not ok 51 - subtest sync throw fails @@ -591,6 +599,8 @@ not ok 53 - describe async throw fails failureType: 'testTimeoutFailure' error: 'test timed out after 5ms' code: 'ERR_TEST_FAILURE' + stack: |- + async Promise.all (index 1) ... # Subtest: large timeout async test is ok ok 3 - large timeout async test is ok diff --git a/test/fixtures/test-runner/output/hooks.snapshot b/test/fixtures/test-runner/output/hooks.snapshot index 5afe398ed3d0ea..07dcf8563f7488 100644 --- a/test/fixtures/test-runner/output/hooks.snapshot +++ b/test/fixtures/test-runner/output/hooks.snapshot @@ -140,6 +140,8 @@ not ok 3 - after throws * * * + async Promise.all (index 1) + * * ... 1..2 @@ -190,6 +192,7 @@ not ok 4 - beforeEach throws * * * + async Promise.all (index 1) * ... 1..2 @@ -218,10 +221,10 @@ not ok 5 - afterEach throws * * * + * new Promise () * * - Array.map () ... # Subtest: 2 ok 2 - 2 @@ -254,10 +257,10 @@ not ok 6 - afterEach when test fails * * * + * new Promise () * * - Array.map () ... # Subtest: 2 not ok 2 - 2 @@ -276,6 +279,7 @@ not ok 6 - afterEach when test fails * * * + async Promise.all (index 1) * ... 1..2 @@ -489,6 +493,7 @@ not ok 11 - t.afterEach throws * * * + * ... # Subtest: 2 ok 2 - 2 @@ -523,6 +528,7 @@ not ok 12 - afterEach when test fails * * * + * ... # Subtest: 2 not ok 2 - 2 diff --git a/test/fixtures/test-runner/output/junit_reporter.snapshot b/test/fixtures/test-runner/output/junit_reporter.snapshot index 6516387e7ed582..876882bf7f436c 100644 --- a/test/fixtures/test-runner/output/junit_reporter.snapshot +++ b/test/fixtures/test-runner/output/junit_reporter.snapshot @@ -18,7 +18,8 @@ * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -35,7 +36,8 @@ * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -59,7 +61,8 @@ * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -79,7 +82,8 @@ * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -96,7 +100,8 @@ * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -118,6 +123,7 @@ true !== false * * * + * * { generatedMessage: true, code: 'ERR_ASSERTION', @@ -141,7 +147,8 @@ true !== false * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -167,7 +174,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail * * * - at Test.postRun (node:internal/test_runner/test:715:19), + at Test.dequeue (node:internal/test_runner/test:529:17), code: 'ERR_TEST_FAILURE' } @@ -213,7 +220,8 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -263,7 +271,8 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail * * * - at async Test.processPendingSubtests (node:internal/test_runner/test:374:7), + * + at async startSubtest (node:internal/test_runner/harness:208:3), code: 'ERR_TEST_FAILURE' } @@ -350,7 +359,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at first * * * - at Test.postRun (node:internal/test_runner/test:715:19), + at Test.dequeue (node:internal/test_runner/test:529:17), code: 'ERR_TEST_FAILURE' } @@ -370,7 +379,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at second * * * - at async Test.run (node:internal/test_runner/test:632:9), + at process.processImmediate (node:internal/timers:449:9), code: 'ERR_TEST_FAILURE' } diff --git a/test/fixtures/test-runner/output/output.snapshot b/test/fixtures/test-runner/output/output.snapshot index 18f030dab361ab..96bf97bb81d959 100644 --- a/test/fixtures/test-runner/output/output.snapshot +++ b/test/fixtures/test-runner/output/output.snapshot @@ -25,6 +25,7 @@ not ok 3 - sync fail todo # TODO * * * + * ... # Subtest: sync fail todo with message not ok 4 - sync fail todo with message # TODO this is a failing todo @@ -42,6 +43,7 @@ not ok 4 - sync fail todo with message # TODO this is a failing todo * * * + * ... # Subtest: sync skip pass ok 5 - sync skip pass # SKIP @@ -75,6 +77,7 @@ not ok 8 - sync throw fail * * * + * ... # Subtest: async skip pass ok 9 - async skip pass # SKIP @@ -102,6 +105,7 @@ not ok 11 - async throw fail * * * + * ... # Subtest: async skip fail not ok 12 - async skip fail # SKIP @@ -119,6 +123,7 @@ not ok 12 - async skip fail # SKIP * * * + * ... # Subtest: async assertion fail not ok 13 - async assertion fail @@ -144,6 +149,7 @@ not ok 13 - async assertion fail * * * + * ... # Subtest: resolve pass ok 14 - resolve pass @@ -166,6 +172,7 @@ not ok 15 - reject fail * * * + * ... # Subtest: unhandled rejection - passes but warns ok 16 - unhandled rejection - passes but warns @@ -319,6 +326,7 @@ not ok 28 - sync skip option is false fail * * * + * ... # Subtest: ok 29 - @@ -417,6 +425,7 @@ not ok 43 - callback throw * * * + * ... # Subtest: callback called twice not ok 44 - callback called twice diff --git a/test/fixtures/test-runner/output/output_cli.snapshot b/test/fixtures/test-runner/output/output_cli.snapshot index 3cef8f29b253b9..2535ecb1442fb5 100644 --- a/test/fixtures/test-runner/output/output_cli.snapshot +++ b/test/fixtures/test-runner/output/output_cli.snapshot @@ -25,6 +25,7 @@ not ok 3 - sync fail todo # TODO * * * + * ... # Subtest: sync fail todo with message not ok 4 - sync fail todo with message # TODO this is a failing todo @@ -42,6 +43,7 @@ not ok 4 - sync fail todo with message # TODO this is a failing todo * * * + * ... # Subtest: sync skip pass ok 5 - sync skip pass # SKIP @@ -75,6 +77,7 @@ not ok 8 - sync throw fail * * * + * ... # Subtest: async skip pass ok 9 - async skip pass # SKIP @@ -102,6 +105,7 @@ not ok 11 - async throw fail * * * + * ... # Subtest: async skip fail not ok 12 - async skip fail # SKIP @@ -119,6 +123,7 @@ not ok 12 - async skip fail # SKIP * * * + * ... # Subtest: async assertion fail not ok 13 - async assertion fail @@ -144,6 +149,7 @@ not ok 13 - async assertion fail * * * + * ... # Subtest: resolve pass ok 14 - resolve pass @@ -166,6 +172,7 @@ not ok 15 - reject fail * * * + * ... # Subtest: unhandled rejection - passes but warns ok 16 - unhandled rejection - passes but warns @@ -319,6 +326,7 @@ not ok 28 - sync skip option is false fail * * * + * ... # Subtest: ok 29 - @@ -417,6 +425,7 @@ not ok 43 - callback throw * * * + * ... # Subtest: callback called twice not ok 44 - callback called twice diff --git a/test/fixtures/test-runner/output/spec_reporter.snapshot b/test/fixtures/test-runner/output/spec_reporter.snapshot index 5dc05d5b43c12d..b8f353c29a8c9e 100644 --- a/test/fixtures/test-runner/output/spec_reporter.snapshot +++ b/test/fixtures/test-runner/output/spec_reporter.snapshot @@ -9,6 +9,7 @@ * * * + * sync fail todo with message (*ms) # this is a failing todo Error: thrown from sync fail todo with message @@ -19,6 +20,7 @@ * * * + * sync skip pass (*ms) # SKIP sync skip pass with message (*ms) # this is skipped @@ -33,6 +35,7 @@ * * * + * async skip pass (*ms) # SKIP async pass (*ms) @@ -45,6 +48,7 @@ * * * + * async skip fail (*ms) # SKIP Error: thrown from async throw fail @@ -55,6 +59,7 @@ * * * + * async assertion fail (*ms) AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: @@ -67,6 +72,7 @@ * * * + * * { generatedMessage: true, code: 'ERR_ASSERTION', @@ -85,6 +91,7 @@ * * * + * unhandled rejection - passes but warns (*ms) async unhandled rejection - passes but warns (*ms) @@ -140,6 +147,7 @@ * * * + * (*ms) functionOnly (*ms) @@ -170,6 +178,7 @@ * * * + * callback called twice (*ms) 'callback invoked multiple times' @@ -311,6 +320,7 @@ * * * + * * sync fail todo with message (*ms) # this is a failing todo @@ -322,6 +332,7 @@ * * * + * * sync throw fail (*ms) @@ -333,6 +344,7 @@ * * * + * * async throw fail (*ms) @@ -344,6 +356,7 @@ * * * + * * async skip fail (*ms) # SKIP @@ -355,6 +368,7 @@ * * * + * * async assertion fail (*ms) @@ -368,6 +382,7 @@ * * * + * * { generatedMessage: true, code: 'ERR_ASSERTION', @@ -386,6 +401,7 @@ * * * + * * +sync throw fail (*ms) @@ -419,6 +435,7 @@ * * * + * * callback fail (*ms) @@ -440,6 +457,7 @@ * * * + * * callback called twice (*ms) diff --git a/test/fixtures/test-runner/output/spec_reporter_cli.snapshot b/test/fixtures/test-runner/output/spec_reporter_cli.snapshot index 25c22069c3b8e7..ab98930063659b 100644 --- a/test/fixtures/test-runner/output/spec_reporter_cli.snapshot +++ b/test/fixtures/test-runner/output/spec_reporter_cli.snapshot @@ -9,6 +9,7 @@ * * * + * sync fail todo with message (*ms) # this is a failing todo Error: thrown from sync fail todo with message @@ -19,6 +20,7 @@ * * * + * sync skip pass (*ms) # SKIP sync skip pass with message (*ms) # this is skipped @@ -33,6 +35,7 @@ * * * + * async skip pass (*ms) # SKIP async pass (*ms) @@ -45,6 +48,7 @@ * * * + * async skip fail (*ms) # SKIP Error: thrown from async throw fail @@ -55,6 +59,7 @@ * * * + * async assertion fail (*ms) AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: @@ -67,6 +72,7 @@ * * * + * * { generatedMessage: true, code: 'ERR_ASSERTION', @@ -85,6 +91,7 @@ * * * + * unhandled rejection - passes but warns (*ms) async unhandled rejection - passes but warns (*ms) @@ -140,6 +147,7 @@ * * * + * (*ms) functionOnly (*ms) @@ -170,6 +178,7 @@ * * * + * callback called twice (*ms) 'callback invoked multiple times' @@ -311,6 +320,7 @@ * * * + * * sync fail todo with message (*ms) # this is a failing todo @@ -322,6 +332,7 @@ * * * + * * sync throw fail (*ms) @@ -333,6 +344,7 @@ * * * + * * async throw fail (*ms) @@ -344,6 +356,7 @@ * * * + * * async skip fail (*ms) # SKIP @@ -355,6 +368,7 @@ * * * + * * async assertion fail (*ms) @@ -368,6 +382,7 @@ * * * + * * { generatedMessage: true, code: 'ERR_ASSERTION', @@ -386,6 +401,7 @@ * * * + * * +sync throw fail (*ms) @@ -419,6 +435,7 @@ * * * + * * callback fail (*ms) @@ -440,6 +457,7 @@ * * * + * * callback called twice (*ms) From 37e13737cab5c1868aac8fc66d8aa6b7714ad07b Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Wed, 26 Jul 2023 09:14:48 +0300 Subject: [PATCH 3/3] test_runner: make enqueue explicit --- lib/internal/test_runner/harness.js | 14 ++++----- lib/internal/test_runner/test.js | 24 ++++++++++----- .../test-runner/output/describe_it.js | 4 +-- .../test-runner/output/describe_it.snapshot | 29 ++++++------------- .../test-runner/output/hooks.snapshot | 6 ---- .../output/junit_reporter.snapshot | 20 ++++++------- 6 files changed, 44 insertions(+), 53 deletions(-) diff --git a/lib/internal/test_runner/harness.js b/lib/internal/test_runner/harness.js index 2f18b0bcf091ac..9dacdf74397571 100644 --- a/lib/internal/test_runner/harness.js +++ b/lib/internal/test_runner/harness.js @@ -2,7 +2,6 @@ const { ArrayPrototypeForEach, FunctionPrototypeBind, - PromiseResolve, SafeMap, } = primordials; const { getCallerLocation } = internalBinding('util'); @@ -210,20 +209,21 @@ function getGlobalRoot() { return globalRoot; } -async function startSubtest(subtest) { +async function startSubtest(subtest, parent) { await reportersSetup; getGlobalRoot().harness.bootstrapComplete = true; - await subtest.start(); + if (parent instanceof Suite) { + subtest.enqueue(); + } else { + await subtest.start(); + } } function runInParentContext(Factory) { function run(name, options, fn, overrides) { const parent = testResources.get(executionAsyncId()) || getGlobalRoot(); const subtest = parent.createSubtest(Factory, name, options, fn, overrides); - if (!(parent instanceof Suite)) { - return startSubtest(subtest); - } - return PromiseResolve(); + return startSubtest(subtest, parent); } const test = (name, options, fn) => { diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 083cb2a94a88df..5d9fc7e7a00196 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -318,6 +318,7 @@ class Test extends AsyncResource { this.fn = fn; this.harness = null; // Configured on the root test by the test harness. this.mock = null; + this.enqueued = null; this.cancelled = false; this.skipped = skip !== undefined && skip !== false; this.isTodo = todo !== undefined && todo !== false; @@ -529,18 +530,25 @@ class Test extends AsyncResource { return this.run(); } + enqueue() { + if (this.enqueued) { + return this.enqueued.promise; + } + this.reporter.enqueue(this.nesting, kFilename, this.name); + this.enqueued = createDeferredPromise(); + this.enqueued.test = this; + this.parent.addPendingSubtest(this.enqueued); + return this.enqueued.promise; + } + start() { // If there is enough available concurrency to run the test now, then do // it. Otherwise, return a Promise to the caller and mark the test as // pending for later execution. - this.reporter.enqueue(this.nesting, this.loc, this.name); - if (!this.parent.hasConcurrency()) { - const deferred = createDeferredPromise(); - - deferred.test = this; - this.parent.addPendingSubtest(deferred); - return deferred.promise; + if (this.enqueued || !this.parent.hasConcurrency()) { + return this.enqueue(); } + this.reporter.enqueue(this.nesting, kFilename, this.name); return this.dequeue(); } @@ -938,7 +946,7 @@ class Suite extends Test { } await this.runHook('before', hookArgs); - + this.processPendingSubtests(); stopPromise = stopTest(this.timeout, this.signal); const subtests = this.skipped || this.error ? [] : this.subtests; const promise = SafePromiseAll(subtests, (subtests) => subtests.start()); diff --git a/test/fixtures/test-runner/output/describe_it.js b/test/fixtures/test-runner/output/describe_it.js index ba6a1aed064614..1e9ac7c401b94a 100644 --- a/test/fixtures/test-runner/output/describe_it.js +++ b/test/fixtures/test-runner/output/describe_it.js @@ -290,12 +290,12 @@ describe('subtest sync throw fails', () => { }); describe('describe sync throw fails', () => { - it('should not run', () => {}); + it('should run', () => {}); throw new Error('thrown from describe'); }); describe('describe async throw fails', async () => { - it('should not run', () => {}); + it('should run', () => {}); throw new Error('thrown from describe'); }); diff --git a/test/fixtures/test-runner/output/describe_it.snapshot b/test/fixtures/test-runner/output/describe_it.snapshot index ced1d9b03c7a6f..0466a576642ecd 100644 --- a/test/fixtures/test-runner/output/describe_it.snapshot +++ b/test/fixtures/test-runner/output/describe_it.snapshot @@ -211,9 +211,6 @@ ok 21 - immediate resolve pass * * * - new Promise () - * - * ... # Subtest: mixing describe/it and test should work ok 2 - mixing describe/it and test should work @@ -483,7 +480,7 @@ not ok 50 - custom inspect symbol that throws fail * * * - new Promise () + * * * ... @@ -518,14 +515,10 @@ not ok 51 - subtest sync throw fails code: 'ERR_TEST_FAILURE' ... # Subtest: describe sync throw fails - # Subtest: should not run - not ok 1 - should not run + # Subtest: should run + ok 1 - should run --- - duration_ms: ZERO - location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3' - failureType: 'cancelledByParent' - error: 'test did not finish before its parent and was cancelled' - code: 'ERR_TEST_FAILURE' + duration_ms: * ... 1..1 not ok 52 - describe sync throw fails @@ -549,14 +542,10 @@ not ok 52 - describe sync throw fails * ... # Subtest: describe async throw fails - # Subtest: should not run - not ok 1 - should not run + # Subtest: should run + ok 1 - should run --- - duration_ms: ZERO - location: '/test/fixtures/test-runner/output/describe_it.js:(LINE):3' - failureType: 'cancelledByParent' - error: 'test did not finish before its parent and was cancelled' - code: 'ERR_TEST_FAILURE' + duration_ms: * ... 1..1 not ok 53 - describe async throw fails @@ -711,9 +700,9 @@ not ok 58 - invalid subtest fail # Warning: Test "callback async throw after done" generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event. # tests 67 # suites 11 -# pass 31 +# pass 33 # fail 19 -# cancelled 4 +# cancelled 2 # skipped 9 # todo 4 # duration_ms * diff --git a/test/fixtures/test-runner/output/hooks.snapshot b/test/fixtures/test-runner/output/hooks.snapshot index 07dcf8563f7488..c13b5846539153 100644 --- a/test/fixtures/test-runner/output/hooks.snapshot +++ b/test/fixtures/test-runner/output/hooks.snapshot @@ -222,9 +222,6 @@ not ok 5 - afterEach throws * * * - new Promise () - * - * ... # Subtest: 2 ok 2 - 2 @@ -258,9 +255,6 @@ not ok 6 - afterEach when test fails * * * - new Promise () - * - * ... # Subtest: 2 not ok 2 - 2 diff --git a/test/fixtures/test-runner/output/junit_reporter.snapshot b/test/fixtures/test-runner/output/junit_reporter.snapshot index 876882bf7f436c..5fe246c1899b76 100644 --- a/test/fixtures/test-runner/output/junit_reporter.snapshot +++ b/test/fixtures/test-runner/output/junit_reporter.snapshot @@ -19,7 +19,7 @@ * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -37,7 +37,7 @@ * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -62,7 +62,7 @@ * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -83,7 +83,7 @@ * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -101,7 +101,7 @@ * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -148,7 +148,7 @@ true !== false * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -174,7 +174,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail * * * - at Test.dequeue (node:internal/test_runner/test:529:17), + at Test.dequeue (node:internal/test_runner/test:530:17), code: 'ERR_TEST_FAILURE' } @@ -221,7 +221,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -272,7 +272,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fail * * * - at async startSubtest (node:internal/test_runner/harness:208:3), + at async startSubtest (node:internal/test_runner/harness:210:5), code: 'ERR_TEST_FAILURE' } @@ -359,7 +359,7 @@ Error [ERR_TEST_FAILURE]: thrown from subtest sync throw fails at first * * * - at Test.dequeue (node:internal/test_runner/test:529:17), + at Test.dequeue (node:internal/test_runner/test:530:17), code: 'ERR_TEST_FAILURE' }