Jestjs Jest正则表达式以匹配某些测试文件

Jestjs Jest正则表达式以匹配某些测试文件,jestjs,Jestjs,我在dirsrc/test/integration下进行了集成测试。所有文件的名称如下:foo.integration.js 跑步笑话: jest ".*\\.integration\\.js" 产生以下错误: No tests found, exiting with code 1 Run with `--passWithNoTests` to exit with code 0 In /Users/dangruszczyk/workspace/cef/lambda-work

我在dir
src/test/integration
下进行了集成测试。所有文件的名称如下:
foo.integration.js

跑步笑话:

jest ".*\\.integration\\.js"
产生以下错误:

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/dangruszczyk/workspace/cef/lambda-workflow
  7 files checked.
  testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 1 match
  testPathIgnorePatterns: /node_modules/ - 7 matches
  testRegex:  - 0 matches
Pattern: .*\.integration\.js - 0 matches

当然,这个正则表达式应该匹配
src/test/integration/foo.integration.js
()。有没有线索说明它为什么不匹配?

问题是Jest仍然在应用
testMatch
,也就是说,你在它已经确定为测试文件的文件中进行筛选,
src/test/integration/foo.integration.js
既不匹配
***/***.[jt]s?(x)
也不匹配
***/(*)+(spec.[tj]s?(x)
*

要运行这些文件,您最好设置以下选项:

这似乎不是CLI的文档化部分,但在实践中效果很好(目前!)


*有趣的是,
path/to/my test.js
,如…

中所示的示例,为什么不干脆
jest integration
?更简单,但仍然找不到这些测试。我认为Jest要求测试文件以
t(spec | test.[tj]s?(x)
结尾,然后在与之匹配的文件上运行任何额外的正则表达式。我看到了,我怀疑是这样的。但是,在检查Jest CLI文档时,没有提到能够替换
testMatch
。Thanks@DanielGruszczyk是的,我只是在寻找同样的东西来链接文档。。。这让我怀疑这是否是CLI的可靠部分!
jest --testMatch='**/*.integration.js'