"NPM run test"コマンドを実行すると、NPMはすべての単体テストを実行しますが、ユーザー入力が必要な「watch usage」ダイアログを表示します。NPMテストを使用してユーザー入力をスキップする
"NPM run test"をビルドプロセスの一部として実行できるように、この「watch usage」ダイアログをスキップする方法が必要です。私はすでに何も変更しない--forceExitを使ってみました。
このダイアログなしで「NPM run test」を起動するために使用できるコマンドラインパラメータはありますか?あるいは、このダイアログが表示されないようにするpackage.jsonのスクリプトセクションに何かを追加することはできますか?
私のpackage.jsonのスクリプトセクション:
"scripts": {
"start": "node node_modules/react-scripts/bin/react-scripts.js start",
"build": "node node_modules/react-scripts/bin/react-scripts.js build",
"test": "node node_modules/react-scripts/bin/react-scripts.js test --env=jsdom",
"test-coverage": "npm test -- --coverage",
"test-json": "npm test -- --coverage --json",
"eject": "node node_modules/react-scripts/bin/react-scripts.js eject",
"flow": "node node_modules/flow-bin/vendor/flow",
"flow-coverage": "node node_modules/flow-coverage-report/bin/flow-coverage-report.js",
"flow-coverage-report": "if process.platform === 'win32'; then start ./flow-coverage/index.html; else open ./flow-coverage/index.html; fi",
"flow-json": "node node_modules/flow-bin/vendor/flow --json",
"flow-stop": "node node_modules/flow-bin/vendor/flow stop"
}
前述のダイアログ:「NPMテストとして、それを実行しているとき、私は冗談のためのウォッチモードを無効にする1つの方法を考え出した
Watch usage
> Press u to update failing snapshots.
> Press p to filter by a filename regex pattern.
> Press t to filter by a test name regex pattern.
> Press q to quit watch mode.
> Press Enter to trigger a test run.