diff --git a/test/fixtures/test-runner/output/test-runner-plan.js b/test/fixtures/test-runner/output/test-runner-plan.js index 7248e4771870d7..6603bd8cee8c12 100644 --- a/test/fixtures/test-runner/output/test-runner-plan.js +++ b/test/fixtures/test-runner/output/test-runner-plan.js @@ -1,5 +1,6 @@ 'use strict'; const { test } = require('node:test'); +const { Readable } = require('stream'); test('test planning basic', (t) => { t.plan(2); @@ -52,3 +53,22 @@ test('subtest planning by options', (t) => { }); }); +test('failing more assertions than planned', (t) => { + t.plan(2); + t.assert.ok(true); + t.assert.ok(true); + t.assert.ok(true); +}); + +test('planning with streams', async (t) => { + function* generate() { + yield 'a'; + yield 'b'; + yield 'c'; + } + const expected = ['a', 'b', 'c']; + t.plan(expected.length); + for await (const chunk of Readable.from(generate())) { + t.assert.strictEqual(chunk, expected.shift()); + } +}) diff --git a/test/fixtures/test-runner/output/test-runner-plan.snapshot b/test/fixtures/test-runner/output/test-runner-plan.snapshot index 837401a53d9b95..b172c2da05a884 100644 --- a/test/fixtures/test-runner/output/test-runner-plan.snapshot +++ b/test/fixtures/test-runner/output/test-runner-plan.snapshot @@ -80,11 +80,25 @@ ok 9 - subtest planning by options --- duration_ms: * ... -1..9 -# tests 13 +# Subtest: failing more assertions than planned +not ok 10 - failing more assertions than planned + --- + duration_ms: * + location: '/test/fixtures/test-runner/output/test-runner-plan.js:(LINE):1' + failureType: 'testCodeFailure' + error: 'plan expected 2 assertions but received 3' + code: 'ERR_TEST_FAILURE' + ... +# Subtest: planning with streams +ok 11 - planning with streams + --- + duration_ms: * + ... +1..11 +# tests 15 # suites 0 -# pass 10 -# fail 3 +# pass 11 +# fail 4 # cancelled 0 # skipped 0 # todo 0