| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3879814 commit 846e2b2
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,7 +77,11 @@ async function spawnAndAssert(filename, transform = (x) => x, { tty = false, ... | |||
| 77 | 77 | test({ skip: 'Skipping pseudo-tty tests, as pseudo terminals are not available on Windows.' }); | |
| 78 | 78 | return; | |
| 79 | 79 | } | |
| 80 | - const flags = common.parseTestFlags(filename); | ||
| 80 | + let flags = common.parseTestFlags(filename); | ||
| 81 | + if (options.flags) { | ||
| 82 | + flags = [...options.flags, ...flags]; | ||
| 83 | + } | ||
| 84 | + | ||
| 81 | 85 | const executable = tty ? (process.env.PYTHON || 'python3') : process.execPath; | |
| 82 | 86 | const args = | |
| 83 | 87 | tty ? | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,8 @@ for (const isolation of ['none', 'process']) { | |||
| 26 | 26 | { | |
| 27 | 27 | // Default behavior. node_modules is ignored. Files that don't match the | |
| 28 | 28 | // pattern are ignored except in test/ directories. | |
| 29 | - const args = ['--test', `--experimental-test-isolation=${isolation}`]; | ||
| 29 | + const args = ['--test', '--test-reporter=tap', | ||
| 30 | + `--experimental-test-isolation=${isolation}`]; | ||
| 30 | 31 | const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'default-behavior') }); | |
| 31 | 32 | ||
| 32 | 33 | assert.strictEqual(child.status, 1); | |
@@ -47,6 +48,7 @@ for (const isolation of ['none', 'process']) { | |||
| 47 | 48 | const args = [ | |
| 48 | 49 | '--require', join(testFixtures, 'protoMutation.js'), | |
| 49 | 50 | '--test', | |
| 51 | + '--test-reporter=tap', | ||
| 50 | 52 | `--experimental-test-isolation=${isolation}`, | |
| 51 | 53 | ]; | |
| 52 | 54 | const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'default-behavior') }); | |
@@ -67,6 +69,7 @@ for (const isolation of ['none', 'process']) { | |||
| 67 | 69 | // User specified files that don't match the pattern are still run. | |
| 68 | 70 | const args = [ | |
| 69 | 71 | '--test', | |
| 72 | + '--test-reporter=tap', | ||
| 70 | 73 | `--experimental-test-isolation=${isolation}`, | |
| 71 | 74 | join(testFixtures, 'index.js'), | |
| 72 | 75 | ]; | |
@@ -83,6 +86,7 @@ for (const isolation of ['none', 'process']) { | |||
| 83 | 86 | // Searches node_modules if specified. | |
| 84 | 87 | const args = [ | |
| 85 | 88 | '--test', | |
| 89 | + '--test-reporter=tap', | ||
| 86 | 90 | `--experimental-test-isolation=${isolation}`, | |
| 87 | 91 | join(testFixtures, 'default-behavior/node_modules/*.js'), | |
| 88 | 92 | ]; | |
@@ -105,18 +109,19 @@ for (const isolation of ['none', 'process']) { | |||
| 105 | 109 | assert.strictEqual(child.signal, null); | |
| 106 | 110 | assert.strictEqual(child.stderr.toString(), ''); | |
| 107 | 111 | const stdout = child.stdout.toString(); | |
| 108 | - assert.match(stdout, /ok 1 - this should pass/); | ||
| 109 | - assert.match(stdout, /not ok 2 - this should fail/); | ||
| 110 | - assert.match(stdout, /ok 3 - subdir.+subdir_test\.js/); | ||
| 111 | - assert.match(stdout, /ok 4 - this should pass/); | ||
| 112 | - assert.match(stdout, /ok 5 - this should be skipped/); | ||
| 113 | - assert.match(stdout, /ok 6 - this should be executed/); | ||
| 112 | + assert.match(stdout, /this should pass/); | ||
| 113 | + assert.match(stdout, /this should fail/); | ||
| 114 | + assert.match(stdout, /subdir.+subdir_test\.js/); | ||
| 115 | + assert.match(stdout, /this should pass/); | ||
| 116 | + assert.match(stdout, /this should be skipped/); | ||
| 117 | + assert.match(stdout, /this should be executed/); | ||
| 114 | 118 | } | |
| 115 | 119 | ||
| 116 | 120 | { | |
| 117 | 121 | // Test combined stream outputs | |
| 118 | 122 | const args = [ | |
| 119 | 123 | '--test', | |
| 124 | + '--test-reporter=tap', | ||
| 120 | 125 | `--experimental-test-isolation=${isolation}`, | |
| 121 | 126 | 'test/fixtures/test-runner/default-behavior/index.test.js', | |
| 122 | 127 | 'test/fixtures/test-runner/nested.js', | |
@@ -189,6 +194,7 @@ for (const isolation of ['none', 'process']) { | |||
| 189 | 194 | // Test user logging in tests. | |
| 190 | 195 | const args = [ | |
| 191 | 196 | '--test', | |
| 197 | + '--test-reporter=tap', | ||
| 192 | 198 | 'test/fixtures/test-runner/user-logs.js', | |
| 193 | 199 | ]; | |
| 194 | 200 | const child = spawnSync(process.execPath, args); | |
@@ -223,7 +229,7 @@ for (const isolation of ['none', 'process']) { | |||
| 223 | 229 | assert.strictEqual(child.status, 0); | |
| 224 | 230 | assert.strictEqual(child.signal, null); | |
| 225 | 231 | const stdout = child.stdout.toString(); | |
| 226 | - assert.match(stdout, /ok 1 - this should pass/); | ||
| 232 | + assert.match(stdout, /this should pass/); | ||
| 227 | 233 | } | |
| 228 | 234 | ||
| 229 | 235 | { | |
@@ -290,6 +296,7 @@ for (const isolation of ['none', 'process']) { | |||
| 290 | 296 | // --test-shard option, first shard | |
| 291 | 297 | const args = [ | |
| 292 | 298 | '--test', | |
| 299 | + '--test-reporter=tap', | ||
| 293 | 300 | '--test-shard=1/2', | |
| 294 | 301 | join(testFixtures, 'shards/*.cjs'), | |
| 295 | 302 | ]; | |
@@ -324,6 +331,7 @@ for (const isolation of ['none', 'process']) { | |||
| 324 | 331 | // --test-shard option, last shard | |
| 325 | 332 | const args = [ | |
| 326 | 333 | '--test', | |
| 334 | + '--test-reporter=tap', | ||
| 327 | 335 | '--test-shard=2/2', | |
| 328 | 336 | join(testFixtures, 'shards/*.cjs'), | |
| 329 | 337 | ]; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ async function runAndKill(file) { | |||
| 12 | 12 | return; | |
| 13 | 13 | } | |
| 14 | 14 | let stdout = ''; | |
| 15 | - const child = spawn(process.execPath, ['--test', file]); | ||
| 15 | + const child = spawn(process.execPath, ['--test', '--test-reporter=tap', file]); | ||
| 16 | 16 | child.stdout.setEncoding('utf8'); | |
| 17 | 17 | child.stdout.on('data', (chunk) => { | |
| 18 | 18 | if (!stdout.length) child.kill('SIGINT'); | |
@@ -58,10 +58,10 @@ if (process.argv[2] === 'child') { | |||
| 58 | 58 | assert.strictEqual(child.status, 0); | |
| 59 | 59 | assert.strictEqual(child.signal, null); | |
| 60 | 60 | const stdout = child.stdout.toString(); | |
| 61 | - assert.match(stdout, /# tests 3/); | ||
| 62 | - assert.match(stdout, /# pass 0/); | ||
| 63 | - assert.match(stdout, /# fail 0/); | ||
| 64 | - assert.match(stdout, /# todo 3/); | ||
| 61 | + assert.match(stdout, /tests 3/); | ||
| 62 | + assert.match(stdout, /pass 0/); | ||
| 63 | + assert.match(stdout, /fail 0/); | ||
| 64 | + assert.match(stdout, /todo 3/); | ||
| 65 | 65 | ||
| 66 | 66 | child = spawnSync(process.execPath, [__filename, 'child', 'fail']); | |
| 67 | 67 | assert.strictEqual(child.status, 1); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,10 +10,10 @@ const { spawnSync } = require('child_process'); | |||
| 10 | 10 | fixtures.path('test-runner', 'extraneous_set_immediate_async.mjs'), | |
| 11 | 11 | ]); | |
| 12 | 12 | const stdout = child.stdout.toString(); | |
| 13 | - assert.match(stdout, /^# Error: Test "extraneous async activity test" at .+extraneous_set_immediate_async\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 14 | - assert.match(stdout, /^# pass 1/m); | ||
| 15 | - assert.match(stdout, /^# fail 1$/m); | ||
| 16 | - assert.match(stdout, /^# cancelled 0$/m); | ||
| 13 | + assert.match(stdout, /Error: Test "extraneous async activity test" at .+extraneous_set_immediate_async\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 14 | + assert.match(stdout, /pass 1/m); | ||
| 15 | + assert.match(stdout, /fail 1$/m); | ||
| 16 | + assert.match(stdout, /cancelled 0$/m); | ||
| 17 | 17 | assert.strictEqual(child.status, 1); | |
| 18 | 18 | assert.strictEqual(child.signal, null); | |
| 19 | 19 | } | |
@@ -24,10 +24,10 @@ const { spawnSync } = require('child_process'); | |||
| 24 | 24 | fixtures.path('test-runner', 'extraneous_set_timeout_async.mjs'), | |
| 25 | 25 | ]); | |
| 26 | 26 | const stdout = child.stdout.toString(); | |
| 27 | - assert.match(stdout, /^# Error: Test "extraneous async activity test" at .+extraneous_set_timeout_async\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 28 | - assert.match(stdout, /^# pass 1$/m); | ||
| 29 | - assert.match(stdout, /^# fail 1$/m); | ||
| 30 | - assert.match(stdout, /^# cancelled 0$/m); | ||
| 27 | + assert.match(stdout, /Error: Test "extraneous async activity test" at .+extraneous_set_timeout_async\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 28 | + assert.match(stdout, /pass 1$/m); | ||
| 29 | + assert.match(stdout, /fail 1$/m); | ||
| 30 | + assert.match(stdout, /cancelled 0$/m); | ||
| 31 | 31 | assert.strictEqual(child.status, 1); | |
| 32 | 32 | assert.strictEqual(child.signal, null); | |
| 33 | 33 | } | |
@@ -38,13 +38,13 @@ const { spawnSync } = require('child_process'); | |||
| 38 | 38 | fixtures.path('test-runner', 'async-error-in-test-hook.mjs'), | |
| 39 | 39 | ]); | |
| 40 | 40 | const stdout = child.stdout.toString(); | |
| 41 | - assert.match(stdout, /^# Error: Test hook "before" at .+async-error-in-test-hook\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 42 | - assert.match(stdout, /^# Error: Test hook "beforeEach" at .+async-error-in-test-hook\.mjs:9:1 generated asynchronous activity after the test ended/m); | ||
| 43 | - assert.match(stdout, /^# Error: Test hook "after" at .+async-error-in-test-hook\.mjs:15:1 generated asynchronous activity after the test ended/m); | ||
| 44 | - assert.match(stdout, /^# Error: Test hook "afterEach" at .+async-error-in-test-hook\.mjs:21:1 generated asynchronous activity after the test ended/m); | ||
| 45 | - assert.match(stdout, /^# pass 1$/m); | ||
| 46 | - assert.match(stdout, /^# fail 1$/m); | ||
| 47 | - assert.match(stdout, /^# cancelled 0$/m); | ||
| 41 | + assert.match(stdout, /Error: Test hook "before" at .+async-error-in-test-hook\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 42 | + assert.match(stdout, /Error: Test hook "beforeEach" at .+async-error-in-test-hook\.mjs:9:1 generated asynchronous activity after the test ended/m); | ||
| 43 | + assert.match(stdout, /Error: Test hook "after" at .+async-error-in-test-hook\.mjs:15:1 generated asynchronous activity after the test ended/m); | ||
| 44 | + assert.match(stdout, /Error: Test hook "afterEach" at .+async-error-in-test-hook\.mjs:21:1 generated asynchronous activity after the test ended/m); | ||
| 45 | + assert.match(stdout, /pass 1$/m); | ||
| 46 | + assert.match(stdout, /fail 1$/m); | ||
| 47 | + assert.match(stdout, /cancelled 0$/m); | ||
| 48 | 48 | assert.strictEqual(child.status, 1); | |
| 49 | 49 | assert.strictEqual(child.signal, null); | |
| 50 | 50 | } | |
@@ -56,13 +56,13 @@ const { spawnSync } = require('child_process'); | |||
| 56 | 56 | fixtures.path('test-runner', 'async-error-in-test-hook.mjs'), | |
| 57 | 57 | ]); | |
| 58 | 58 | const stdout = child.stdout.toString(); | |
| 59 | - assert.match(stdout, /^# Error: Test hook "before" at .+async-error-in-test-hook\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 60 | - assert.match(stdout, /^# Error: Test hook "beforeEach" at .+async-error-in-test-hook\.mjs:9:1 generated asynchronous activity after the test ended/m); | ||
| 61 | - assert.match(stdout, /^# Error: Test hook "after" at .+async-error-in-test-hook\.mjs:15:1 generated asynchronous activity after the test ended/m); | ||
| 62 | - assert.match(stdout, /^# Error: Test hook "afterEach" at .+async-error-in-test-hook\.mjs:21:1 generated asynchronous activity after the test ended/m); | ||
| 63 | - assert.match(stdout, /^# pass 1$/m); | ||
| 64 | - assert.match(stdout, /^# fail 0$/m); | ||
| 65 | - assert.match(stdout, /^# cancelled 0$/m); | ||
| 59 | + assert.match(stdout, /Error: Test hook "before" at .+async-error-in-test-hook\.mjs:3:1 generated asynchronous activity after the test ended/m); | ||
| 60 | + assert.match(stdout, /Error: Test hook "beforeEach" at .+async-error-in-test-hook\.mjs:9:1 generated asynchronous activity after the test ended/m); | ||
| 61 | + assert.match(stdout, /Error: Test hook "after" at .+async-error-in-test-hook\.mjs:15:1 generated asynchronous activity after the test ended/m); | ||
| 62 | + assert.match(stdout, /Error: Test hook "afterEach" at .+async-error-in-test-hook\.mjs:21:1 generated asynchronous activity after the test ended/m); | ||
| 63 | + assert.match(stdout, /pass 1$/m); | ||
| 64 | + assert.match(stdout, /fail 0$/m); | ||
| 65 | + assert.match(stdout, /cancelled 0$/m); | ||
| 66 | 66 | assert.strictEqual(child.status, 1); | |
| 67 | 67 | assert.strictEqual(child.signal, null); | |
| 68 | 68 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ const fixture = fixtures.path('test-runner/throws_sync_and_async.js'); | |||
| 8 | 8 | for (const isolation of ['none', 'process']) { | |
| 9 | 9 | const args = [ | |
| 10 | 10 | '--test', | |
| 11 | + '--test-reporter=spec', | ||
| 11 | 12 | '--test-force-exit', | |
| 12 | 13 | `--experimental-test-isolation=${isolation}`, | |
| 13 | 14 | fixture, | |
@@ -19,6 +20,6 @@ for (const isolation of ['none', 'process']) { | |||
| 19 | 20 | strictEqual(r.stderr.toString(), ''); | |
| 20 | 21 | ||
| 21 | 22 | const stdout = r.stdout.toString(); | |
| 22 | - match(stdout, /error: 'fails'/); | ||
| 23 | + match(stdout, /Error: fails/); | ||
| 23 | 24 | doesNotMatch(stdout, /this should not have a chance to be thrown/); | |
| 24 | 25 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ tmpdir.refresh(); | |||
| 12 | 12 | ||
| 13 | 13 | { | |
| 14 | 14 | const child = new NodeInstance( | |
| 15 | - ['--test', '--inspect-brk=0'], | ||
| 15 | + ['--test', '--test-reporter=tap', '--inspect-brk=0'], | ||
| 16 | 16 | undefined, | |
| 17 | 17 | fixtures.path('test-runner/default-behavior/index.test.js') | |
| 18 | 18 | ); | |
@@ -38,7 +38,10 @@ tmpdir.refresh(); | |||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | 40 | { | |
| 41 | - const args = ['--test', '--inspect=0', fixtures.path('test-runner/index.js')]; | ||
| 41 | + const args = [ | ||
| 42 | + '--test', '--test-reporter=tap', '--inspect=0', | ||
| 43 | + fixtures.path('test-runner/index.js'), | ||
| 44 | + ]; | ||
| 42 | 45 | const { stderr, stdout, code, signal } = await common.spawnPromisified(process.execPath, args); | |
| 43 | 46 | ||
| 44 | 47 | assert.match(stderr, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,9 +33,9 @@ if (process.argv[2] === 'child') { | |||
| 33 | 33 | } else { | |
| 34 | 34 | const child = spawnSync(process.execPath, [__filename, 'child', 'abortSignal']); | |
| 35 | 35 | const stdout = child.stdout.toString(); | |
| 36 | - assert.match(stdout, /^# pass 2$/m); | ||
| 37 | - assert.match(stdout, /^# fail 0$/m); | ||
| 38 | - assert.match(stdout, /^# cancelled 1$/m); | ||
| 36 | + assert.match(stdout, /pass 2$/m); | ||
| 37 | + assert.match(stdout, /fail 0$/m); | ||
| 38 | + assert.match(stdout, /cancelled 1$/m); | ||
| 39 | 39 | assert.strictEqual(child.status, 1); | |
| 40 | 40 | assert.strictEqual(child.signal, null); | |
| 41 | 41 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -571,7 +571,7 @@ test('node_modules can be used by both module systems', async (t) => { | |||
| 571 | 571 | ||
| 572 | 572 | assert.strictEqual(code, 0); | |
| 573 | 573 | assert.strictEqual(signal, null); | |
| 574 | - assert.match(stdout, /# pass 1/); | ||
| 574 | + assert.match(stdout, /pass 1/); | ||
| 575 | 575 | }); | |
| 576 | 576 | ||
| 577 | 577 | test('file:// imports are supported in ESM only', async (t) => { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ const fixture2 = fixtures.path('test-runner', 'no-isolation', 'two.test.js'); | |||
| 11 | 11 | test('works with --test-only', () => { | |
| 12 | 12 | const args = [ | |
| 13 | 13 | '--test', | |
| 14 | + '--test-reporter=tap', | ||
| 14 | 15 | '--experimental-test-isolation=none', | |
| 15 | 16 | '--test-only', | |
| 16 | 17 | fixture1, | |
@@ -33,6 +34,7 @@ test('works with --test-only', () => { | |||
| 33 | 34 | test('works with --test-name-pattern', () => { | |
| 34 | 35 | const args = [ | |
| 35 | 36 | '--test', | |
| 37 | + '--test-reporter=tap', | ||
| 36 | 38 | '--experimental-test-isolation=none', | |
| 37 | 39 | '--test-name-pattern=/test one/', | |
| 38 | 40 | fixture1, | |
@@ -52,6 +54,7 @@ test('works with --test-name-pattern', () => { | |||
| 52 | 54 | test('works with --test-skip-pattern', () => { | |
| 53 | 55 | const args = [ | |
| 54 | 56 | '--test', | |
| 57 | + '--test-reporter=tap', | ||
| 55 | 58 | '--experimental-test-isolation=none', | |
| 56 | 59 | '--test-skip-pattern=/one/', | |
| 57 | 60 | fixture1, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments