| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e4b795e commit 97d854e
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1037,20 +1037,6 @@ generated as part of the test runner output. If no tests are run, a coverage | |||
| 1037 | 1037 | report is not generated. See the documentation on | |
| 1038 | 1038 | [collecting code coverage from tests][] for more details. | |
| 1039 | 1039 | ||
| 1040 | - ### `--experimental-test-isolation=mode` | ||
| 1041 | - | ||
| 1042 | - <!-- YAML | ||
| 1043 | - added: v22.8.0 | ||
| 1044 | - --> | ||
| 1045 | - | ||
| 1046 | - > Stability: 1.0 - Early development | ||
| 1047 | - | ||
| 1048 | - Configures the type of test isolation used in the test runner. When `mode` is | ||
| 1049 | - `'process'`, each test file is run in a separate child process. When `mode` is | ||
| 1050 | - `'none'`, all test files run in the same process as the test runner. The default | ||
| 1051 | - isolation mode is `'process'`. This flag is ignored if the `--test` flag is not | ||
| 1052 | - present. See the [test runner execution model][] section for more information. | ||
| 1053 | - | ||
| 1054 | 1040 | ### `--experimental-test-module-mocks` | |
| 1055 | 1041 | ||
| 1056 | 1042 | <!-- YAML | |
@@ -2235,8 +2221,8 @@ added: | |||
| 2235 | 2221 | --> | |
| 2236 | 2222 | ||
| 2237 | 2223 | The maximum number of test files that the test runner CLI will execute | |
| 2238 | - concurrently. If `--experimental-test-isolation` is set to `'none'`, this flag | ||
| 2239 | - is ignored and concurrency is one. Otherwise, concurrency defaults to | ||
| 2224 | + concurrently. If `--test-isolation` is set to `'none'`, this flag is ignored and | ||
| 2225 | + concurrency is one. Otherwise, concurrency defaults to | ||
| 2240 | 2226 | `os.availableParallelism() - 1`. | |
| 2241 | 2227 | ||
| 2242 | 2228 | ### `--test-coverage-branches=threshold` | |
@@ -2320,6 +2306,23 @@ added: | |||
| 2320 | 2306 | Configures the test runner to exit the process once all known tests have | |
| 2321 | 2307 | finished executing even if the event loop would otherwise remain active. | |
| 2322 | 2308 | ||
| 2309 | + ### `--test-isolation=mode` | ||
| 2310 | + | ||
| 2311 | + <!-- YAML | ||
| 2312 | + added: v22.8.0 | ||
| 2313 | + changes: | ||
| 2314 | + - version: REPLACEME | ||
| 2315 | + pr-url: https://github.com/nodejs/node/pull/56298 | ||
| 2316 | + description: This flag was renamed from `--experimental-test-isolation` to | ||
| 2317 | + `--test-isolation`. | ||
| 2318 | + --> | ||
| 2319 | + | ||
| 2320 | + Configures the type of test isolation used in the test runner. When `mode` is | ||
| 2321 | + `'process'`, each test file is run in a separate child process. When `mode` is | ||
| 2322 | + `'none'`, all test files run in the same process as the test runner. The default | ||
| 2323 | + isolation mode is `'process'`. This flag is ignored if the `--test` flag is not | ||
| 2324 | + present. See the [test runner execution model][] section for more information. | ||
| 2325 | + | ||
| 2323 | 2326 | ### `--test-name-pattern` | |
| 2324 | 2327 | ||
| 2325 | 2328 | <!-- YAML | |
@@ -3056,6 +3059,7 @@ one is included in the list below. | |||
| 3056 | 3059 | * `--experimental-shadow-realm` | |
| 3057 | 3060 | * `--experimental-specifier-resolution` | |
| 3058 | 3061 | * `--experimental-strip-types` | |
| 3062 | + * `--experimental-test-isolation` | ||
| 3059 | 3063 | * `--experimental-top-level-await` | |
| 3060 | 3064 | * `--experimental-transform-types` | |
| 3061 | 3065 | * `--experimental-vm-modules` | |
@@ -3125,6 +3129,7 @@ one is included in the list below. | |||
| 3125 | 3129 | * `--test-coverage-functions` | |
| 3126 | 3130 | * `--test-coverage-include` | |
| 3127 | 3131 | * `--test-coverage-lines` | |
| 3132 | + * `--test-isolation` | ||
| 3128 | 3133 | * `--test-name-pattern` | |
| 3129 | 3134 | * `--test-only` | |
| 3130 | 3135 | * `--test-reporter-destination` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -180,9 +180,6 @@ Use this flag to enable ShadowRealm support. | |||
| 180 | 180 | .It Fl -experimental-test-coverage | |
| 181 | 181 | Enable code coverage in the test runner. | |
| 182 | 182 | . | |
| 183 | - .It Fl -experimental-test-isolation Ns = Ns Ar mode | ||
| 184 | - Configures the type of test isolation used in the test runner. | ||
| 185 | - . | ||
| 186 | 183 | .It Fl -experimental-test-module-mocks | |
| 187 | 184 | Enable module mocking in the test runner. | |
| 188 | 185 | . | |
@@ -455,6 +452,9 @@ Require a minimum threshold for line coverage (0 - 100). | |||
| 455 | 452 | Configures the test runner to exit the process once all known tests have | |
| 456 | 453 | finished executing even if the event loop would otherwise remain active. | |
| 457 | 454 | . | |
| 455 | + .It Fl -test-isolation Ns = Ns Ar mode | ||
| 456 | + Configures the type of test isolation used in the test runner. | ||
| 457 | + . | ||
| 458 | 458 | .It Fl -test-name-pattern | |
| 459 | 459 | A regular expression that configures the test runner to only execute tests | |
| 460 | 460 | whose name matches the provided pattern. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -241,7 +241,7 @@ function parseCommandLine() { | |||
| 241 | 241 | } | |
| 242 | 242 | ||
| 243 | 243 | if (isTestRunner) { | |
| 244 | - isolation = getOptionValue('--experimental-test-isolation'); | ||
| 244 | + isolation = getOptionValue('--test-isolation'); | ||
| 245 | 245 | timeout = getOptionValue('--test-timeout') || Infinity; | |
| 246 | 246 | ||
| 247 | 247 | if (isolation === 'none') { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,7 +145,7 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors, | |||
| 145 | 145 | debug_options_.allow_attaching_debugger = true; | |
| 146 | 146 | } else { | |
| 147 | 147 | if (test_isolation != "process") { | |
| 148 | - errors->push_back("invalid value for --experimental-test-isolation"); | ||
| 148 | + errors->push_back("invalid value for --test-isolation"); | ||
| 149 | 149 | } | |
| 150 | 150 | ||
| 151 | 151 | #ifndef ALLOW_ATTACHING_DEBUGGER_IN_TEST_RUNNER | |
@@ -683,10 +683,12 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 683 | 683 | "the line coverage minimum threshold", | |
| 684 | 684 | &EnvironmentOptions::test_coverage_lines, | |
| 685 | 685 | kAllowedInEnvvar); | |
| 686 | - | ||
| 687 | - AddOption("--experimental-test-isolation", | ||
| 686 | + AddOption("--test-isolation", | ||
| 688 | 687 | "configures the type of test isolation used in the test runner", | |
| 689 | - &EnvironmentOptions::test_isolation); | ||
| 688 | + &EnvironmentOptions::test_isolation, | ||
| 689 | + kAllowedInEnvvar); | ||
| 690 | + // TODO(cjihrig): Remove this alias in a semver major. | ||
| 691 | + AddAlias("--experimental-test-isolation", "--test-isolation"); | ||
| 690 | 692 | AddOption("--experimental-test-module-mocks", | |
| 691 | 693 | "enable module mocking in the test runner", | |
| 692 | 694 | &EnvironmentOptions::test_runner_module_mocks); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,14 +26,14 @@ test('concurrency of two', async () => { | |||
| 26 | 26 | }); | |
| 27 | 27 | ||
| 28 | 28 | test('isolation=none uses a concurrency of one', async () => { | |
| 29 | - const args = ['--test', '--experimental-test-isolation=none']; | ||
| 29 | + const args = ['--test', '--test-isolation=none']; | ||
| 30 | 30 | const cp = spawnSync(process.execPath, args, { cwd, env }); | |
| 31 | 31 | assert.match(cp.stderr.toString(), /concurrency: 1,/); | |
| 32 | 32 | }); | |
| 33 | 33 | ||
| 34 | 34 | test('isolation=none overrides --test-concurrency', async () => { | |
| 35 | 35 | const args = [ | |
| 36 | - '--test', '--experimental-test-isolation=none', '--test-concurrency=2', | ||
| 36 | + '--test', '--test-isolation=none', '--test-concurrency=2', | ||
| 37 | 37 | ]; | |
| 38 | 38 | const cp = spawnSync(process.execPath, args, { cwd, env }); | |
| 39 | 39 | assert.match(cp.stderr.toString(), /concurrency: 1,/); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ test('timeout of 10ms', async () => { | |||
| 21 | 21 | ||
| 22 | 22 | test('isolation=none uses the --test-timeout flag', async () => { | |
| 23 | 23 | const args = [ | |
| 24 | - '--test', '--experimental-test-isolation=none', '--test-timeout=10', | ||
| 24 | + '--test', '--test-isolation=none', '--test-timeout=10', | ||
| 25 | 25 | ]; | |
| 26 | 26 | const cp = spawnSync(process.execPath, args, { cwd, env }); | |
| 27 | 27 | assert.match(cp.stderr.toString(), /timeout: 10,/); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ for (const isolation of ['none', 'process']) { | |||
| 12 | 12 | // File not found. | |
| 13 | 13 | const args = [ | |
| 14 | 14 | '--test', | |
| 15 | - `--experimental-test-isolation=${isolation}`, | ||
| 15 | + `--test-isolation=${isolation}`, | ||
| 16 | 16 | 'a-random-file-that-does-not-exist.js', | |
| 17 | 17 | ]; | |
| 18 | 18 | const child = spawnSync(process.execPath, args); | |
@@ -27,7 +27,7 @@ for (const isolation of ['none', 'process']) { | |||
| 27 | 27 | // Default behavior. node_modules is ignored. Files that don't match the | |
| 28 | 28 | // pattern are ignored except in test/ directories. | |
| 29 | 29 | const args = ['--test', '--test-reporter=tap', | |
| 30 | - `--experimental-test-isolation=${isolation}`]; | ||
| 30 | + `--test-isolation=${isolation}`]; | ||
| 31 | 31 | const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'default-behavior') }); | |
| 32 | 32 | ||
| 33 | 33 | assert.strictEqual(child.status, 1); | |
@@ -46,7 +46,7 @@ for (const isolation of ['none', 'process']) { | |||
| 46 | 46 | { | |
| 47 | 47 | // Should match files with "-test.(c|m)js" suffix. | |
| 48 | 48 | const args = ['--test', '--test-reporter=tap', | |
| 49 | - `--experimental-test-isolation=${isolation}`]; | ||
| 49 | + `--test-isolation=${isolation}`]; | ||
| 50 | 50 | const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'matching-patterns') }); | |
| 51 | 51 | ||
| 52 | 52 | assert.strictEqual(child.status, 0); | |
@@ -64,7 +64,7 @@ for (const isolation of ['none', 'process']) { | |||
| 64 | 64 | for (const type of ['strip', 'transform']) { | |
| 65 | 65 | // Should match files with "-test.(c|m)(t|j)s" suffix when typescript support is enabled | |
| 66 | 66 | const args = ['--test', '--test-reporter=tap', '--no-warnings', | |
| 67 | - `--experimental-${type}-types`, `--experimental-test-isolation=${isolation}`]; | ||
| 67 | + `--experimental-${type}-types`, `--test-isolation=${isolation}`]; | ||
| 68 | 68 | const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'matching-patterns') }); | |
| 69 | 69 | ||
| 70 | 70 | if (!process.config.variables.node_use_amaro) { | |
@@ -91,7 +91,7 @@ for (const isolation of ['none', 'process']) { | |||
| 91 | 91 | '--require', join(testFixtures, 'protoMutation.js'), | |
| 92 | 92 | '--test', | |
| 93 | 93 | '--test-reporter=tap', | |
| 94 | - `--experimental-test-isolation=${isolation}`, | ||
| 94 | + `--test-isolation=${isolation}`, | ||
| 95 | 95 | ]; | |
| 96 | 96 | const child = spawnSync(process.execPath, args, { cwd: join(testFixtures, 'default-behavior') }); | |
| 97 | 97 | ||
@@ -112,7 +112,7 @@ for (const isolation of ['none', 'process']) { | |||
| 112 | 112 | const args = [ | |
| 113 | 113 | '--test', | |
| 114 | 114 | '--test-reporter=tap', | |
| 115 | - `--experimental-test-isolation=${isolation}`, | ||
| 115 | + `--test-isolation=${isolation}`, | ||
| 116 | 116 | join(testFixtures, 'index.js'), | |
| 117 | 117 | ]; | |
| 118 | 118 | const child = spawnSync(process.execPath, args, { cwd: testFixtures }); | |
@@ -129,7 +129,7 @@ for (const isolation of ['none', 'process']) { | |||
| 129 | 129 | const args = [ | |
| 130 | 130 | '--test', | |
| 131 | 131 | '--test-reporter=tap', | |
| 132 | - `--experimental-test-isolation=${isolation}`, | ||
| 132 | + `--test-isolation=${isolation}`, | ||
| 133 | 133 | join(testFixtures, 'default-behavior/node_modules/*.js'), | |
| 134 | 134 | ]; | |
| 135 | 135 | const child = spawnSync(process.execPath, args); | |
@@ -143,7 +143,7 @@ for (const isolation of ['none', 'process']) { | |||
| 143 | 143 | ||
| 144 | 144 | { | |
| 145 | 145 | // The current directory is used by default. | |
| 146 | - const args = ['--test', `--experimental-test-isolation=${isolation}`]; | ||
| 146 | + const args = ['--test', `--test-isolation=${isolation}`]; | ||
| 147 | 147 | const options = { cwd: join(testFixtures, 'default-behavior') }; | |
| 148 | 148 | const child = spawnSync(process.execPath, args, options); | |
| 149 | 149 | ||
@@ -165,7 +165,7 @@ for (const isolation of ['none', 'process']) { | |||
| 165 | 165 | const args = [ | |
| 166 | 166 | '--test', | |
| 167 | 167 | '--test-reporter=tap', | |
| 168 | - `--experimental-test-isolation=${isolation}`, | ||
| 168 | + `--test-isolation=${isolation}`, | ||
| 169 | 169 | 'test/fixtures/test-runner/default-behavior/index.test.js', | |
| 170 | 170 | 'test/fixtures/test-runner/nested.js', | |
| 171 | 171 | 'test/fixtures/test-runner/invalid-tap.js', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -260,7 +260,7 @@ test.skip('coverage works with isolation=none', skipIfNoInspector, () => { | |||
| 260 | 260 | '--experimental-test-coverage', | |
| 261 | 261 | '--test-reporter', | |
| 262 | 262 | 'tap', | |
| 263 | - '--experimental-test-isolation=none', | ||
| 263 | + '--test-isolation=none', | ||
| 264 | 264 | ]; | |
| 265 | 265 | const result = spawnSync(process.execPath, args, { | |
| 266 | 266 | env: { ...process.env, NODE_TEST_TMPDIR: tmpdir.path }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,7 +52,7 @@ const { spawnSync } = require('child_process'); | |||
| 52 | 52 | { | |
| 53 | 53 | const child = spawnSync(process.execPath, [ | |
| 54 | 54 | '--test', | |
| 55 | - '--experimental-test-isolation=none', | ||
| 55 | + '--test-isolation=none', | ||
| 56 | 56 | fixtures.path('test-runner', 'async-error-in-test-hook.mjs'), | |
| 57 | 57 | ]); | |
| 58 | 58 | const stdout = child.stdout.toString(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ for (const isolation of ['none', 'process']) { | |||
| 10 | 10 | '--test', | |
| 11 | 11 | '--test-reporter=spec', | |
| 12 | 12 | '--test-force-exit', | |
| 13 | - `--experimental-test-isolation=${isolation}`, | ||
| 13 | + `--test-isolation=${isolation}`, | ||
| 14 | 14 | fixture, | |
| 15 | 15 | ]; | |
| 16 | 16 | const r = spawnSync(process.execPath, args); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments