| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 428301a commit 4b2e258
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,6 +17,9 @@ const { | |||
| 17 | 17 | RegExpPrototypeExec, | |
| 18 | 18 | StringPrototypeSplit, | |
| 19 | 19 | } = primordials; | |
| 20 | + let debug = require('internal/util/debuglog').debuglog('test_runner', (fn) => { | ||
| 21 | + debug = fn; | ||
| 22 | + }); | ||
| 20 | 23 | ||
| 21 | 24 | prepareMainThreadExecution(false); | |
| 22 | 25 | markBootstrapComplete(); | |
@@ -56,8 +59,15 @@ if (shardOption) { | |||
| 56 | 59 | }; | |
| 57 | 60 | } | |
| 58 | 61 | ||
| 59 | - run({ concurrency, inspectPort, watch: getOptionValue('--watch'), setup: setupTestReporters, shard }) | ||
| 60 | - .on('test:fail', (data) => { | ||
| 62 | + const options = { | ||
| 63 | + concurrency, | ||
| 64 | + inspectPort, | ||
| 65 | + watch: getOptionValue('--watch'), | ||
| 66 | + setup: setupTestReporters, | ||
| 67 | + shard, | ||
| 68 | + }; | ||
| 69 | + debug('test runner configuration:', options); | ||
| 70 | + run(options).on('test:fail', (data) => { | ||
| 61 | 71 | if (data.todo === undefined || data.todo === false) { | |
| 62 | 72 | process.exitCode = 1; | |
| 63 | 73 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,45 +1,26 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - const common = require('../common'); | ||
| 3 | - const tmpdir = require('../common/tmpdir'); | ||
| 4 | - const { deepStrictEqual, strictEqual } = require('node:assert'); | ||
| 2 | + require('../common'); | ||
| 3 | + const fixtures = require('../common/fixtures'); | ||
| 4 | + const assert = require('node:assert'); | ||
| 5 | 5 | const { spawnSync } = require('node:child_process'); | |
| 6 | - const { readdirSync, writeFileSync } = require('node:fs'); | ||
| 7 | - const { join } = require('node:path'); | ||
| 8 | - const { beforeEach, test } = require('node:test'); | ||
| 6 | + const { test } = require('node:test'); | ||
| 7 | + const cwd = fixtures.path('test-runner', 'default-behavior'); | ||
| 8 | + const env = { ...process.env, 'NODE_DEBUG': 'test_runner' }; | ||
| 9 | 9 | ||
| 10 | - function createTestFile(name) { | ||
| 11 | - writeFileSync(join(tmpdir.path, name), ` | ||
| 12 | - const fs = require('node:fs'); | ||
| 13 | - | ||
| 14 | - fs.unlinkSync(__filename); | ||
| 15 | - setTimeout(() => {}, 1_000_000_000); | ||
| 16 | - `); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - beforeEach(() => { | ||
| 20 | - tmpdir.refresh(); | ||
| 21 | - createTestFile('test-1.js'); | ||
| 22 | - createTestFile('test-2.js'); | ||
| 10 | + test('default concurrency', async () => { | ||
| 11 | + const args = ['--test']; | ||
| 12 | + const cp = spawnSync(process.execPath, args, { cwd, env }); | ||
| 13 | + assert.match(cp.stderr.toString(), /concurrency: true,/); | ||
| 23 | 14 | }); | |
| 24 | 15 | ||
| 25 | - test('concurrency of one', () => { | ||
| 26 | - const cp = spawnSync(process.execPath, ['--test', '--test-concurrency=1'], { | ||
| 27 | - cwd: tmpdir.path, | ||
| 28 | - timeout: common.platformTimeout(1000), | ||
| 29 | - }); | ||
| 30 | - | ||
| 31 | - strictEqual(cp.stderr.toString(), ''); | ||
| 32 | - strictEqual(cp.error.code, 'ETIMEDOUT'); | ||
| 33 | - deepStrictEqual(readdirSync(tmpdir.path), ['test-2.js']); | ||
| 16 | + test('concurrency of one', async () => { | ||
| 17 | + const args = ['--test', '--test-concurrency=1']; | ||
| 18 | + const cp = spawnSync(process.execPath, args, { cwd, env }); | ||
| 19 | + assert.match(cp.stderr.toString(), /concurrency: 1,/); | ||
| 34 | 20 | }); | |
| 35 | 21 | ||
| 36 | - test('concurrency of two', () => { | ||
| 37 | - const cp = spawnSync(process.execPath, ['--test', '--test-concurrency=2'], { | ||
| 38 | - cwd: tmpdir.path, | ||
| 39 | - timeout: common.platformTimeout(1000), | ||
| 40 | - }); | ||
| 41 | - | ||
| 42 | - strictEqual(cp.stderr.toString(), ''); | ||
| 43 | - strictEqual(cp.error.code, 'ETIMEDOUT'); | ||
| 44 | - deepStrictEqual(readdirSync(tmpdir.path), []); | ||
| 22 | + test('concurrency of two', async () => { | ||
| 23 | + const args = ['--test', '--test-concurrency=2']; | ||
| 24 | + const cp = spawnSync(process.execPath, args, { cwd, env }); | ||
| 25 | + assert.match(cp.stderr.toString(), /concurrency: 2,/); | ||
| 45 | 26 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments