| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -706,10 +706,12 @@ class Test extends AsyncResource { | |||
| 706 | 706 | this.fn = () => { | |
| 707 | 707 | for (let i = 0; i < (previousAttempt.children?.length ?? 0); i++) { | |
| 708 | 708 | const child = previousAttempt.children[i]; | |
| 709 | - this.createSubtest(Test, child.name, { __proto__: null }, noop, { | ||
| 709 | + const t = this.createSubtest(Test, child.name, { __proto__: null }, noop, { | ||
| 710 | 710 | __proto__: null, | |
| 711 | 711 | loc: [child.line, child.column, child.file], | |
| 712 | - }, noop).start(); | ||
| 712 | + }, noop); | ||
| 713 | + t.endTime = t.startTime = hrtime(); | ||
| 714 | + t.start(); | ||
| 713 | 715 | } | |
| 714 | 716 | }; | |
| 715 | 717 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - const { test } = require('node:test') | ||
| 1 | + const { test, describe } = require('node:test') | ||
| 2 | 2 | ||
| 3 | 3 | test('should fail on first two attempts', ({ attempt }) => { | |
| 4 | 4 | if (attempt < 2) { | |
@@ -38,3 +38,11 @@ function nestedAmbiguousTest(expectedAttempts) { | |||
| 38 | 38 | ||
| 39 | 39 | test('nested ambiguous (expectedAttempts=0)', nestedAmbiguousTest(0)); | |
| 40 | 40 | test('nested ambiguous (expectedAttempts=1)', nestedAmbiguousTest(2)); | |
| 41 | + | ||
| 42 | + | ||
| 43 | + describe('describe rerun', { timeout: 1000, concurrency: 1000 }, () => { | ||
| 44 | + test('passed on first attempt', async (t) => { | ||
| 45 | + await t.test('nested', async () => {}); | ||
| 46 | + }); | ||
| 47 | + test('a'); | ||
| 48 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,10 @@ const expectedStateFile = [ | |||
| 23 | 23 | 'test/fixtures/test-runner/rerun.js:39:1': { passed_on_attempt: 0, name: 'nested ambiguous (expectedAttempts=0)' }, | |
| 24 | 24 | 'test/fixtures/test-runner/rerun.js:30:16:(1)': { passed_on_attempt: 0, name: '2 levels deep' }, | |
| 25 | 25 | 'test/fixtures/test-runner/rerun.js:35:13:(1)': { passed_on_attempt: 0, name: 'ok' }, | |
| 26 | + 'test/fixtures/test-runner/rerun.js:45:13': { passed_on_attempt: 0, name: 'nested' }, | ||
| 27 | + 'test/fixtures/test-runner/rerun.js:44:3': { passed_on_attempt: 0, name: 'passed on first attempt' }, | ||
| 28 | + 'test/fixtures/test-runner/rerun.js:47:3': { passed_on_attempt: 0, name: 'a' }, | ||
| 29 | + 'test/fixtures/test-runner/rerun.js:43:1': { passed_on_attempt: 0, name: 'describe rerun' }, | ||
| 26 | 30 | }, | |
| 27 | 31 | { | |
| 28 | 32 | 'test/fixtures/test-runner/rerun.js:9:1': { passed_on_attempt: 0, name: 'ok' }, | |
@@ -34,6 +38,11 @@ const expectedStateFile = [ | |||
| 34 | 38 | 'test/fixtures/test-runner/rerun.js:39:1': { passed_on_attempt: 0, name: 'nested ambiguous (expectedAttempts=0)' }, | |
| 35 | 39 | 'test/fixtures/test-runner/rerun.js:30:16:(1)': { passed_on_attempt: 0, name: '2 levels deep' }, | |
| 36 | 40 | 'test/fixtures/test-runner/rerun.js:35:13:(1)': { passed_on_attempt: 0, name: 'ok' }, | |
| 41 | + 'test/fixtures/test-runner/rerun.js:43:1': { passed_on_attempt: 0, name: 'describe rerun' }, | ||
| 42 | + 'test/fixtures/test-runner/rerun.js:44:3': { passed_on_attempt: 0, name: 'passed on first attempt' }, | ||
| 43 | + 'test/fixtures/test-runner/rerun.js:45:13': { passed_on_attempt: 0, name: 'nested' }, | ||
| 44 | + 'test/fixtures/test-runner/rerun.js:45:13:(1)': { passed_on_attempt: 1, name: 'nested' }, | ||
| 45 | + 'test/fixtures/test-runner/rerun.js:47:3': { passed_on_attempt: 0, name: 'a' }, | ||
| 37 | 46 | }, | |
| 38 | 47 | { | |
| 39 | 48 | 'test/fixtures/test-runner/rerun.js:3:1': { passed_on_attempt: 2, name: 'should fail on first two attempts' }, | |
@@ -48,6 +57,11 @@ const expectedStateFile = [ | |||
| 48 | 57 | 'test/fixtures/test-runner/rerun.js:30:16:(1)': { passed_on_attempt: 0, name: '2 levels deep' }, | |
| 49 | 58 | 'test/fixtures/test-runner/rerun.js:35:13:(1)': { passed_on_attempt: 0, name: 'ok' }, | |
| 50 | 59 | 'test/fixtures/test-runner/rerun.js:40:1': { passed_on_attempt: 2, name: 'nested ambiguous (expectedAttempts=1)' }, | |
| 60 | + 'test/fixtures/test-runner/rerun.js:43:1': { passed_on_attempt: 0, name: 'describe rerun' }, | ||
| 61 | + 'test/fixtures/test-runner/rerun.js:44:3': { passed_on_attempt: 0, name: 'passed on first attempt' }, | ||
| 62 | + 'test/fixtures/test-runner/rerun.js:45:13': { passed_on_attempt: 0, name: 'nested' }, | ||
| 63 | + 'test/fixtures/test-runner/rerun.js:45:13:(1)': { passed_on_attempt: 1, name: 'nested' }, | ||
| 64 | + 'test/fixtures/test-runner/rerun.js:47:3': { passed_on_attempt: 0, name: 'a' }, | ||
| 51 | 65 | }, | |
| 52 | 66 | ]; | |
| 53 | 67 | ||
@@ -67,23 +81,26 @@ test('test should pass on third rerun', async () => { | |||
| 67 | 81 | let { code, stdout, signal } = await common.spawnPromisified(process.execPath, args); | |
| 68 | 82 | assert.strictEqual(code, 1); | |
| 69 | 83 | assert.strictEqual(signal, null); | |
| 70 | - assert.match(stdout, /pass 8/); | ||
| 84 | + assert.match(stdout, /pass 11/); | ||
| 71 | 85 | assert.match(stdout, /fail 4/); | |
| 86 | + assert.match(stdout, /suites 1/); | ||
| 72 | 87 | assert.deepStrictEqual(await getStateFile(), expectedStateFile.slice(0, 1)); | |
| 73 | 88 | ||
| 74 | 89 | ({ code, stdout, signal } = await common.spawnPromisified(process.execPath, args)); | |
| 75 | 90 | assert.strictEqual(code, 1); | |
| 76 | 91 | assert.strictEqual(signal, null); | |
| 77 | - assert.match(stdout, /pass 9/); | ||
| 92 | + assert.match(stdout, /pass 13/); | ||
| 78 | 93 | assert.match(stdout, /fail 3/); | |
| 94 | + assert.match(stdout, /suites 1/); | ||
| 79 | 95 | assert.deepStrictEqual(await getStateFile(), expectedStateFile.slice(0, 2)); | |
| 80 | 96 | ||
| 81 | 97 | ||
| 82 | 98 | ({ code, stdout, signal } = await common.spawnPromisified(process.execPath, args)); | |
| 83 | 99 | assert.strictEqual(code, 0); | |
| 84 | 100 | assert.strictEqual(signal, null); | |
| 85 | - assert.match(stdout, /pass 12/); | ||
| 101 | + assert.match(stdout, /pass 18/); | ||
| 86 | 102 | assert.match(stdout, /fail 0/); | |
| 103 | + assert.match(stdout, /suites 1/); | ||
| 87 | 104 | assert.deepStrictEqual(await getStateFile(), expectedStateFile); | |
| 88 | 105 | }); | |
| 89 | 106 | ||
@@ -93,29 +110,32 @@ test('test should pass on third rerun with `--test`', async () => { | |||
| 93 | 110 | let { code, stdout, signal } = await common.spawnPromisified(process.execPath, args); | |
| 94 | 111 | assert.strictEqual(code, 1); | |
| 95 | 112 | assert.strictEqual(signal, null); | |
| 96 | - assert.match(stdout, /pass 8/); | ||
| 113 | + assert.match(stdout, /pass 11/); | ||
| 97 | 114 | assert.match(stdout, /fail 4/); | |
| 115 | + assert.match(stdout, /suites 1/); | ||
| 98 | 116 | assert.deepStrictEqual(await getStateFile(), expectedStateFile.slice(0, 1)); | |
| 99 | 117 | ||
| 100 | 118 | ({ code, stdout, signal } = await common.spawnPromisified(process.execPath, args)); | |
| 101 | 119 | assert.strictEqual(code, 1); | |
| 102 | 120 | assert.strictEqual(signal, null); | |
| 103 | - assert.match(stdout, /pass 9/); | ||
| 121 | + assert.match(stdout, /pass 13/); | ||
| 104 | 122 | assert.match(stdout, /fail 3/); | |
| 123 | + assert.match(stdout, /suites 1/); | ||
| 105 | 124 | assert.deepStrictEqual(await getStateFile(), expectedStateFile.slice(0, 2)); | |
| 106 | 125 | ||
| 107 | 126 | ||
| 108 | 127 | ({ code, stdout, signal } = await common.spawnPromisified(process.execPath, args)); | |
| 109 | 128 | assert.strictEqual(code, 0); | |
| 110 | 129 | assert.strictEqual(signal, null); | |
| 111 | - assert.match(stdout, /pass 12/); | ||
| 130 | + assert.match(stdout, /pass 18/); | ||
| 112 | 131 | assert.match(stdout, /fail 0/); | |
| 132 | + assert.match(stdout, /suites 1/); | ||
| 113 | 133 | assert.deepStrictEqual(await getStateFile(), expectedStateFile); | |
| 114 | 134 | }); | |
| 115 | 135 | ||
| 116 | 136 | test('using `run` api', async () => { | |
| 117 | 137 | let stream = run({ files: [fixture], rerunFailuresFilePath: stateFile }); | |
| 118 | - stream.on('test:pass', common.mustCall(8)); | ||
| 138 | + stream.on('test:pass', common.mustCall(12)); | ||
| 119 | 139 | stream.on('test:fail', common.mustCall(4)); | |
| 120 | 140 | ||
| 121 | 141 | // eslint-disable-next-line no-unused-vars | |
@@ -125,7 +145,7 @@ test('using `run` api', async () => { | |||
| 125 | 145 | ||
| 126 | 146 | ||
| 127 | 147 | stream = run({ files: [fixture], rerunFailuresFilePath: stateFile }); | |
| 128 | - stream.on('test:pass', common.mustCall(9)); | ||
| 148 | + stream.on('test:pass', common.mustCall(14)); | ||
| 129 | 149 | stream.on('test:fail', common.mustCall(3)); | |
| 130 | 150 | ||
| 131 | 151 | // eslint-disable-next-line no-unused-vars | |
@@ -135,7 +155,7 @@ test('using `run` api', async () => { | |||
| 135 | 155 | ||
| 136 | 156 | ||
| 137 | 157 | stream = run({ files: [fixture], rerunFailuresFilePath: stateFile }); | |
| 138 | - stream.on('test:pass', common.mustCall(12)); | ||
| 158 | + stream.on('test:pass', common.mustCall(19)); | ||
| 139 | 159 | stream.on('test:fail', common.mustNotCall()); | |
| 140 | 160 | ||
| 141 | 161 | // eslint-disable-next-line no-unused-vars | |
| Back | FazBrowse Home | New Git URL |
0 commit comments