gitlab - 未找到开 Jest 测试

标签 gitlab jestjs gitlab-ci

我在 gitlab 作业中有以下输出:

yarn run v1.15.2
$ jest --verbose
No tests found
In /path/to/my/project/
  47 files checked.
  testMatch:  - 47 matches
  testPathIgnorePatterns: /node_modules/,/build,/lib/ - 0 matches
  testRegex: (/__tests__/.*|\.(test|spec))\.(tsx?|jsx?)$ - 1 match
Pattern:  - 0 matches

测试没有被执行,我在这里做错了什么?我在其他项目中使用了相同的 gitlab-ci.yml 配置。

如有任何帮助,我们将不胜感激!

最佳答案

是的,错误在package.json中,我在jest选项下的testPathIgnorePatternsmodulePathIgnorePatterns路径中缺少<rootDir>。

"testPathIgnorePatterns": [
  "<rootDir>/node_modules/",
  "<rootDir>/build",
  "<rootDir>/lib/"
],
"modulePathIgnorePatterns": [
  "<rootDir>/dist/",
  "<rootDir>/build/"
]

关于gitlab - 未找到开 Jest 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55901514/

相关文章:

mysql - 为什么某些 Rails 项目使用多个具有不同扩展名的 database.yml 文件(mysql、postgresql 等)?

reactjs - package.json 中的 Jest 配置失败

mysql - Symfony 3 GitLab CI SQLSTATE[HY000] [2002] 没有这样的文件或目录 MySQL 连接

docker - Gitlab DOCKER_AUTH_CONFIG 不起作用

gitlab - 与 master 相比,如何根据更改的文件阻止作业运行?

gitlab 套接字连接 : Connection refused

gitlab云 CI : how to increase memory for shared runner

reactjs - 如何让 Keycloak mock 与 Jest 一起工作

reactjs - 使用 useEffect() 钩子(Hook)在 Jest 中测试函数

node.js - Gitlab-ci 没有使用我指定的 Node 版本