Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 21 additions & 243 deletions doc/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,12 @@
}
]
},
"allow-inspector": {
"type": "boolean"
},
"allow-net": {
"type": "boolean"
},
"allow-wasi": {
"type": "boolean"
},
"allow-worker": {
"type": "boolean"
},
"async-context-frame": {
"type": "boolean"
},
"conditions": {
"oneOf": [
{
Expand Down Expand Up @@ -133,15 +124,30 @@
"experimental-addon-modules": {
"type": "boolean"
},
"experimental-async-context-frame": {
"type": "boolean"
},
"experimental-default-type": {
"type": "string"
},
"experimental-detect-module": {
"type": "boolean"
},
"experimental-eventsource": {
"type": "boolean"
},
"experimental-fetch": {
"type": "boolean"
},
"experimental-global-customevent": {
"type": "boolean"
},
"experimental-global-navigator": {
"type": "boolean"
},
"experimental-global-webcrypto": {
"type": "boolean"
},
"experimental-import-meta-resolve": {
"type": "boolean"
},
Expand All @@ -162,9 +168,6 @@
"experimental-print-required-tla": {
"type": "boolean"
},
"experimental-quic": {
"type": "boolean"
},
"experimental-repl-await": {
"type": "boolean"
},
Expand All @@ -177,6 +180,9 @@
"experimental-sqlite": {
"type": "boolean"
},
"experimental-strip-types": {
"type": "boolean"
},
"experimental-transform-types": {
"type": "boolean"
},
Expand Down Expand Up @@ -361,9 +367,6 @@
"stack-trace-limit": {
"type": "number"
},
"strip-types": {
"type": "boolean"
},
"test-coverage-branches": {
"type": "number"
},
Expand Down Expand Up @@ -401,12 +404,6 @@
"test-coverage-lines": {
"type": "number"
},
"test-global-setup": {
"type": "string"
},
"test-isolation": {
"type": "string"
},
"test-name-pattern": {
"oneOf": [
{
Expand Down Expand Up @@ -452,9 +449,6 @@
}
]
},
"test-rerun-failures": {
"type": "string"
},
"test-shard": {
"type": "string"
},
Expand Down Expand Up @@ -502,6 +496,9 @@
"tls-min-v1.3": {
"type": "boolean"
},
"trace-atomics-wait": {
"type": "boolean"
},
"trace-deprecation": {
"type": "boolean"
},
Expand Down Expand Up @@ -602,225 +599,6 @@
}
},
"type": "object"
},
"permission": {
"type": "object",
"additionalProperties": false,
"properties": {
"allow-addons": {
"type": "boolean"
},
"allow-child-process": {
"type": "boolean"
},
"allow-fs-read": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"allow-fs-write": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"allow-inspector": {
"type": "boolean"
},
"allow-net": {
"type": "boolean"
},
"allow-wasi": {
"type": "boolean"
},
"allow-worker": {
"type": "boolean"
},
"permission": {
"type": "boolean"
}
}
},
"test": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we supposed to remove the prefix instead of the whole namespace no?

"type": "object",
"additionalProperties": false,
"properties": {
"experimental-test-coverage": {
"type": "boolean"
},
"experimental-test-module-mocks": {
"type": "boolean"
},
"test": {
"type": "boolean"
},
"test-concurrency": {
"type": "number"
},
"test-coverage-branches": {
"type": "number"
},
"test-coverage-exclude": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"test-coverage-functions": {
"type": "number"
},
"test-coverage-include": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"test-coverage-lines": {
"type": "number"
},
"test-force-exit": {
"type": "boolean"
},
"test-global-setup": {
"type": "string"
},
"test-isolation": {
"type": "string"
},
"test-name-pattern": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"test-only": {
"type": "boolean"
},
"test-reporter": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"test-reporter-destination": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"test-rerun-failures": {
"type": "string"
},
"test-shard": {
"type": "string"
},
"test-skip-pattern": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"test-timeout": {
"type": "number"
},
"test-update-snapshots": {
"type": "boolean"
}
}
},
"watch": {
"type": "object",
"additionalProperties": false,
"properties": {
"watch": {
"type": "boolean"
},
"watch-kill-signal": {
"type": "string"
},
"watch-path": {
"oneOf": [
{
"type": "string"
},
{
"items": {
"type": "string",
"minItems": 1
},
"type": "array"
}
]
},
"watch-preserve-output": {
"type": "boolean"
}
}
}
},
"type": "object"
Expand Down
23 changes: 21 additions & 2 deletions lib/internal/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,27 @@ function generateConfigJsonSchema() {

// Add all options for this namespace
for (const { 0: optionName, 1: optionType } of optionsMap) {
const keyWithoutPrefix = StringPrototypeReplace(optionName, '--', '');
namespaceProperties[keyWithoutPrefix] = createPropertyForType(optionType);
let keyWithoutPrefix = StringPrototypeReplace(optionName, '--', '');
const originalKey = keyWithoutPrefix;
const propertySchema = createPropertyForType(optionType);

// For `test` and `watch` namespaces, remove the namespace prefix
// from keys to avoid redundancy (e.g., `test-concurrency` -> `concurrency`)
// Also add the prefixed version as an alias for backward compatibility
if (namespace === 'test' && keyWithoutPrefix.startsWith('test-')) {
keyWithoutPrefix = StringPrototypeReplace(keyWithoutPrefix, 'test-', '');
// Add alias: both `concurrency` and `test-concurrency` are valid
namespaceProperties[originalKey] = propertySchema;
namespaceProperties[keyWithoutPrefix] = propertySchema;
} else if (namespace === 'watch' && keyWithoutPrefix.startsWith('watch-')) {
keyWithoutPrefix = StringPrototypeReplace(keyWithoutPrefix, 'watch-', '');
// Add alias: both `path` and `watch-path` are valid
namespaceProperties[originalKey] = propertySchema;
namespaceProperties[keyWithoutPrefix] = propertySchema;
} else {
// For other namespaces or keys without prefix, add normally
namespaceProperties[keyWithoutPrefix] = propertySchema;
}
}

// Sort the namespace properties alphabetically
Expand Down