remove redundancy in node.config schema keys
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、Node の CLI 引数から config schema へのマッピングを追跡し、現在の test キーと watch キーがどのように生成されているかを比較します。Issue の例が意図された結果を定義しています。namespace プレフィックスは削除し、experimental オプションはそのプレフィックスの後に処理し、ネストされた reporter の宛先は再帰的にマッピングする必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- cli, developer-experience
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100