remove redundancy in node.config schema keys
Personne n'a encore pris cette issue.
- Langage dominant
- JavaScript
- Étoiles
- 122k
- Forks
- 37.3k
- Merge moyen
- 4 j 2 h
- PR mergées (30 j)
- 283
Description
What is the problem this feature will solve?
Notice below how in the current schema, the namespaces "test" and "watch" are redundantly specified. This is the result of mapping the CLI args as-is.
{
"$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json",
"test": {
"test-concurrency": 3
"test-isolation": "process"
"test-timeout": 5000
"test-rerun-failures": true
"test-only": true
"test-force-exit": false
"test-name-pattern": "^iso"
"test-skip-pattern": "tree$"
"test-global-setup": "setup-module.mjs"
"experimental-test-coverage": true
"test-coverage-exclude": "test/**"
"test-coverage-include": "src/**"
"test-coverage-branches": 100
"test-coverage-functions": 100
"test-coverage-lines": 100
"test-reporter": ["dot", "spec", "lcov"]
"test-reporter-destination": ["stdout", "test.report", "lcov.info"]
"experimental-test-module-mocks": true
"test-update-snapshots": true
},
"watch": {
"watch-preserve-output": true
"watch-path": "./src"
}
}
What is the feature you are proposing to solve the problem?
Instead, the namespace part of the CLI arg could automatically be mapped to a namespace within the config schema:
{
"$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json",
"test": {
"concurrency": 3
"isolation": "process"
"timeout": 5000
"rerun-failures": true
"only": true
"force-exit": false
"name-pattern": "^iso"
"skip-pattern": "tree$"
"global-setup": "setup-module.mjs"
"experimental-coverage": true
"coverage-exclude": "test/**"
"coverage-include": "src/**"
"coverage-branches": 100
"coverage-functions": 100
"coverage-lines": 100
"reporter": ["dot", "spec", "lcov"]
"reporter-destination": ["stdout", "test.report", "lcov.info"]
"experimental-module-mocks": true
"test-update-snapshots": true
},
"watch": {
"preserve-output": true
"path": "./src"
}
}
Note that for "experimental-" CLI args, the mapped namespace occurs after that prefix.
We can take it a step further, apply the idea recursively, as below. This has the added of benefit fixing how destinations are specified when there are multiple test reporters.
{
"$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json",
"test": {
"concurrency": 3
"isolation": "process"
"timeout": 5000
"rerun-failures": true
"only": true
"force-exit": false
"name-pattern": "^iso"
"skip-pattern": "tree$"
"global-setup": "setup-module.mjs"
"experimental-coverage": {
"exclude": "test/**"
"include": "src/**"
"branches": 100
"functions": 100
"lines": 100
}
"reporter": {
"dot": {"destination": "stdout"}
"spec": {"destination": "test.report"}
"lcov": {"destination": "lcov.info"}
}
"experimental-module-mocks": true
"update-snapshots": true
},
"watch": {
"preserve-output": true
"path": "./src"
}
}
What alternatives have you considered?
No response
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par retracer la correspondance entre les arguments CLI de Node et le schéma de configuration, puis comparez la manière dont les clés test et watch actuelles sont générées. Les exemples de l’issue définissent le résultat attendu : les préfixes d’espace de noms doivent être supprimés, les options expérimentales traitées après leur préfixe et les destinations imbriquées de reporter mappées récursivement.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, node.js
- Domaine
- cli, developer-experience
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 42/100