WebStorm——自定义测试命令

WebStorm - customize the test command

如图所示,WebStorm通过react-scripts test --testNamePattern=pattern开始测试 但是,鉴于我使用 craco 来覆盖 webpack 配置,并且通常我使用 env-cmd 来加载环境变量(例如,env-cmd -f .env.staging && yarn test),我想自定义测试命令.

目前,将其更改为 craco test --testNamePattern=pattern 就足够了。

可能吗?

可以通过更改 Jest package 字段来更改配置设置中的命令。

尝试将 node_modules/@craco/craco 设置为 Jest 包: 在您的 Jest 运行 配置中: