作者:永恒多一天_313 | 来源:互联网 | 2022-12-09 10:21
我试图在Team City中运行我的Jest单元测试,但最终总是得到如下所示的提示。
No tests found related to files changed since last commit.
Press `a` to run all tests, or run Jest with `--watchAll`.
Watch Usage
› Press a to run all tests.
› Press f to run only failed tests.
› 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.
我尝试运行yarn test a
所有测试。但是一旦测试完成执行,我仍然会收到相同的提示。我试过了,yarn test a q
但是不行。我也尝试过yarn test a --forceExit
,yarn test a --bail
但没有任何反应,我仍然得到提示。我如何运行所有的Jest测试而不会收到此提示,因为在Team City中运行时将没有任何交互?任何帮助将非常感激。
1> Senior Pomid..:
--ci
提供此选项后,Jest将假定它在CI环境中运行。遇到新快照时,这会更改行为。它不会通过自动存储新快照的常规行为,而是会使测试失败,并要求使用--updateSnapshot运行Jest。 链接
另外,您可以更改package.json
为:
"test": "CI=true react-scripts test --env=jsdom",
哪个很棒