mirror of
https://github.com/nodejs/node.git
synced 2025-12-27 23:41:14 +00:00
src: rename config file testRunner to test
PR-URL: https://github.com/nodejs/node/pull/60798 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
parent
46dc5d7c9f
commit
8b769cff60
@ -1016,7 +1016,7 @@ in the `$schema` must be replaced with the version of Node.js you are using.
|
||||
"watch-path": "src",
|
||||
"watch-preserve-output": true
|
||||
},
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-isolation": "process"
|
||||
},
|
||||
"watch": {
|
||||
@ -1029,7 +1029,7 @@ The configuration file supports namespace-specific options:
|
||||
|
||||
* The `nodeOptions` field contains CLI flags that are allowed in [`NODE_OPTIONS`][].
|
||||
|
||||
* Namespace fields like `testRunner` contain configuration specific to that subsystem.
|
||||
* Namespace fields like `test` contain configuration specific to that subsystem.
|
||||
|
||||
No-op flags are not supported.
|
||||
Not all V8 flags are currently supported.
|
||||
|
||||
@ -655,7 +655,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
|
||||
@ -262,8 +262,20 @@ ParseResult ConfigReader::ParseConfig(const std::string_view& config_path) {
|
||||
return ParseResult::InvalidContent;
|
||||
}
|
||||
|
||||
// Check if this field is a valid namespace
|
||||
std::string namespace_name(field_name);
|
||||
|
||||
// TODO(@marco-ippolito): Remove warning for testRunner namespace
|
||||
if (namespace_name == "testRunner") {
|
||||
FPrintF(stderr,
|
||||
"the \"testRunner\" namespace has been removed. "
|
||||
"Use \"test\" instead.\n");
|
||||
// Better to throw an error than to ignore it
|
||||
// Otherwise users might think their test suite is green
|
||||
// when it's not running
|
||||
return ParseResult::InvalidContent;
|
||||
}
|
||||
|
||||
// Check if this field is a valid namespace
|
||||
if (!valid_namespaces.contains(namespace_name)) {
|
||||
// If not, skip it
|
||||
continue;
|
||||
|
||||
@ -415,7 +415,7 @@ std::vector<std::string> MapAvailableNamespaces();
|
||||
// Define all namespace entries
|
||||
#define OPTION_NAMESPACE_LIST(V) \
|
||||
V(kNoNamespace, "") \
|
||||
V(kTestRunnerNamespace, "testRunner") \
|
||||
V(kTestRunnerNamespace, "test") \
|
||||
V(kWatchNamespace, "watch") \
|
||||
V(kPermissionNamespace, "permission")
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"experimental-transform-types": true,
|
||||
"max-http-header-size": 8192
|
||||
},
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-isolation": "none"
|
||||
}
|
||||
}
|
||||
|
||||
5
test/fixtures/rc/deprecated-testrunner-namespace.json
vendored
Normal file
5
test/fixtures/rc/deprecated-testrunner-namespace.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test-isolation": "none"
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-name-pattern": "first-pattern",
|
||||
"test-name-pattern": "second-pattern"
|
||||
}
|
||||
|
||||
2
test/fixtures/rc/empty-valid-namespace.json
vendored
2
test/fixtures/rc/empty-valid-namespace.json
vendored
@ -1,3 +1,3 @@
|
||||
{
|
||||
"testRunner": {}
|
||||
"test": {}
|
||||
}
|
||||
|
||||
2
test/fixtures/rc/namespace-with-array.json
vendored
2
test/fixtures/rc/namespace-with-array.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-coverage-exclude": ["config-pattern1", "config-pattern2"]
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-concurrency": 1,
|
||||
"experimental-test-coverage": true
|
||||
}
|
||||
|
||||
2
test/fixtures/rc/namespaced/node.config.json
vendored
2
test/fixtures/rc/namespaced/node.config.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-isolation": "none"
|
||||
}
|
||||
}
|
||||
|
||||
2
test/fixtures/rc/override-namespace.json
vendored
2
test/fixtures/rc/override-namespace.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-isolation": "process"
|
||||
},
|
||||
"nodeOptions": {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"nodeOptions": {
|
||||
"test-isolation": "none"
|
||||
},
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"test-isolation": "process"
|
||||
}
|
||||
}
|
||||
|
||||
2
test/fixtures/rc/unknown-flag-namespace.json
vendored
2
test/fixtures/rc/unknown-flag-namespace.json
vendored
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"unknown-flag": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"testRunner": {
|
||||
"test": {
|
||||
"experimental-test-coverage": true
|
||||
}
|
||||
}
|
||||
|
||||
@ -421,7 +421,7 @@ describe('namespace-scoped options', () => {
|
||||
fixtures.path('rc/unknown-flag-namespace.json'),
|
||||
'-p', '"Hello, World!"',
|
||||
]);
|
||||
assert.match(result.stderr, /Unknown or not allowed option unknown-flag for namespace testRunner/);
|
||||
assert.match(result.stderr, /Unknown or not allowed option unknown-flag for namespace test/);
|
||||
assert.strictEqual(result.stdout, '');
|
||||
assert.strictEqual(result.code, 9);
|
||||
});
|
||||
@ -542,4 +542,16 @@ describe('namespace-scoped options', () => {
|
||||
assert.strictEqual(result.stdout, '2\n');
|
||||
assert.strictEqual(result.code, 0);
|
||||
});
|
||||
|
||||
it('should throw an error for removed "testRunner" namespace', async () => {
|
||||
const result = await spawnPromisified(process.execPath, [
|
||||
'--no-warnings',
|
||||
'--experimental-config-file',
|
||||
fixtures.path('rc/deprecated-testrunner-namespace.json'),
|
||||
'-p', '"Hello, World!"',
|
||||
]);
|
||||
assert.match(result.stderr, /the "testRunner" namespace has been removed\. Use "test" instead\./);
|
||||
assert.strictEqual(result.stdout, '');
|
||||
assert.strictEqual(result.code, 9);
|
||||
});
|
||||
});
|
||||
|
||||
@ -68,19 +68,19 @@ describe('test runner flag propagation', () => {
|
||||
|
||||
describe('via config file', () => {
|
||||
const configFilePropagationTests = [
|
||||
['--test-concurrency', 2, 2, 'testRunner'],
|
||||
['--test-timeout', 5000, 5000, 'testRunner'],
|
||||
['--test-coverage-branches', 100, 100, 'testRunner'],
|
||||
['--test-coverage-functions', 100, 100, 'testRunner'],
|
||||
['--test-coverage-lines', 100, 100, 'testRunner'],
|
||||
['--experimental-test-coverage', true, false, 'testRunner'],
|
||||
['--test-coverage-exclude', 'test/**', 'test/**', 'testRunner'],
|
||||
['--test-coverage-include', 'src/**', 'src/**', 'testRunner'],
|
||||
['--test-update-snapshots', true, true, 'testRunner'],
|
||||
['--test-concurrency', 3, 3, 'testRunner'],
|
||||
['--test-timeout', 2500, 2500, 'testRunner'],
|
||||
['--test-coverage-branches', 90, 90, 'testRunner'],
|
||||
['--test-coverage-functions', 85, 85, 'testRunner'],
|
||||
['--test-concurrency', 2, 2, 'test'],
|
||||
['--test-timeout', 5000, 5000, 'test'],
|
||||
['--test-coverage-branches', 100, 100, 'test'],
|
||||
['--test-coverage-functions', 100, 100, 'test'],
|
||||
['--test-coverage-lines', 100, 100, 'test'],
|
||||
['--experimental-test-coverage', true, false, 'test'],
|
||||
['--test-coverage-exclude', 'test/**', 'test/**', 'test'],
|
||||
['--test-coverage-include', 'src/**', 'src/**', 'test'],
|
||||
['--test-update-snapshots', true, true, 'test'],
|
||||
['--test-concurrency', 3, 3, 'test'],
|
||||
['--test-timeout', 2500, 2500, 'test'],
|
||||
['--test-coverage-branches', 90, 90, 'test'],
|
||||
['--test-coverage-functions', 85, 85, 'test'],
|
||||
];
|
||||
|
||||
for (const [flagName, configValue, expectedValue, namespace] of configFilePropagationTests) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user