-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner, cli: add --test-concurrency flag
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: #49996 Fixes: #49487 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
- Loading branch information
Showing
7 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const tmpdir = require('../common/tmpdir'); | ||
const { deepStrictEqual, strictEqual } = require('node:assert'); | ||
const { spawnSync } = require('node:child_process'); | ||
const { readdirSync, writeFileSync } = require('node:fs'); | ||
const { join } = require('node:path'); | ||
const { beforeEach, test } = require('node:test'); | ||
|
||
function createTestFile(name) { | ||
writeFileSync(join(tmpdir.path, name), ` | ||
const fs = require('node:fs'); | ||
fs.unlinkSync(__filename); | ||
setTimeout(() => {}, 1_000_000_000); | ||
`); | ||
} | ||
|
||
beforeEach(() => { | ||
tmpdir.refresh(); | ||
createTestFile('test-1.js'); | ||
createTestFile('test-2.js'); | ||
}); | ||
|
||
test('concurrency of one', () => { | ||
const cp = spawnSync(process.execPath, ['--test', '--test-concurrency=1'], { | ||
cwd: tmpdir.path, | ||
timeout: common.platformTimeout(1000), | ||
}); | ||
|
||
strictEqual(cp.stderr.toString(), ''); | ||
strictEqual(cp.error.code, 'ETIMEDOUT'); | ||
deepStrictEqual(readdirSync(tmpdir.path), ['test-2.js']); | ||
}); | ||
|
||
test('concurrency of two', () => { | ||
const cp = spawnSync(process.execPath, ['--test', '--test-concurrency=2'], { | ||
cwd: tmpdir.path, | ||
timeout: common.platformTimeout(1000), | ||
}); | ||
|
||
strictEqual(cp.stderr.toString(), ''); | ||
strictEqual(cp.error.code, 'ETIMEDOUT'); | ||
deepStrictEqual(readdirSync(tmpdir.path), []); | ||
}); |