jest 20 移动)-6ren"> jest 20 移动)-我正在使用以下 jest.unittest.json 文件(通过 jest --config 选项使用): { "bail": false, "verbose": true, "trans-6ren">
gpt4 book ai didi

jestjs - Jest 模式 ""- 0 个匹配(从 jest 19 -> jest 20 移动)

转载 作者:行者123 更新时间:2023-12-04 08:54:22 25 4
gpt4 key购买 nike

我正在使用以下 jest.unittest.json 文件(通过 jest --config 选项使用):

{
"bail": false,
"verbose": true,
"transform": {
"^.+\\.(ts|tsx)$": "typescript-babel-jest"
},
"testPathIgnorePatterns": [
"<rootDir>/lib",
"<rootDir>/lib_es6",
"/node_modules/",
"fixtures.ts",
"/fixtures/"
],
"moduleFileExtensions": [
"js", "jsx", "ts", "tsx", "node"
],
"roots": [
"<rootDir>/src/__unittests__/Logger",
"<rootDir>/src/__unittests__/Renderer/renderer.test.ts"
],
"testRegex": "<rootDir>/src/__unittests__/.*\\.test.(ts|tsx|js|jsx)$"
}

注意测试文件是 src/ 单元测试 /Renderer/renderer.test.ts,等等。

它曾经在 jest v19 之前有效,但升级到 v20 后,此配置不再有效。

当我 jest --config jest.unittest.json --verbose 时,我得到:
Pattern: "" - 0 matches
我的配置有问题吗?

最佳答案

尝试改变 testRegex到这样的事情:
"(/src/__unittests__/.*|\\.(test|spec))\\.(ts|tsx|js)$"

关于jestjs - Jest 模式 ""- 0 个匹配(从 jest 19 -> jest 20 移动),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44328549/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com