1
運行命令「NPM運行測試」時,NPM運行所有單元測試,但顯示需要用戶輸入的「監視用法」對話框。使用NPM測試跳過用戶輸入
我希望能夠運行「NPM運行測試」作爲我的構建過程的一部分,所以我想有一種方法可以跳過此「觀看用法」對話框。我已經嘗試使用--forceExit,它不會改變任何東西。
是否有任何命令行參數可用於在沒有此對話框的情況下啓動「NPM運行測試」?或者,我可以添加一些東西到我的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"
}
上述對話框:
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.