Node.js 使用jest测试自定义扩展

Node.js 使用jest测试自定义扩展,node.js,regex,jestjs,Node.js,Regex,Jestjs,我想测试所有.ut.js文件 请参见下面我尝试的内容和输出。我错过了什么?我测试了正则表达式,所以我知道这不是问题所在 我还尝试传递标志testRegex和testMatch并获取zsh:未找到匹配项:… $ yarn jest '**\/*\.ut\.js' yarn jest v0.24.6 $ "/home/goldylucks/apps/ci-workflow-workshop/node_modules/.bin/jest" **\/*\.ut\.js Invalid testPat

我想测试所有
.ut.js
文件

请参见下面我尝试的内容和输出。我错过了什么?我测试了正则表达式,所以我知道这不是问题所在

我还尝试传递标志
testRegex
testMatch
并获取
zsh:未找到匹配项:…

$ yarn jest '**\/*\.ut\.js'
yarn jest v0.24.6
$ "/home/goldylucks/apps/ci-workflow-workshop/node_modules/.bin/jest" **\/*\.ut\.js
  Invalid testPattern **/*.ut.js supplied. Running all tests instead.

$ yarn jest '**\/\.ut\.js'
yarn jest v0.24.6
$ "/home/goldylucks/apps/ci-workflow-workshop/node_modules/.bin/jest" **\/\.ut\.js
  Invalid testPattern **/.ut.js supplied. Running all tests instead.

$ yarn jest '\.ut\.js'
yarn jest v0.24.6
$ "/home/goldylucks/apps/ci-workflow-workshop/node_modules/.bin/jest" \.ut\.js
No tests found
In /home/goldylucks/apps/ci-workflow-workshop
  32 files checked.
  testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
  testPathIgnorePatterns: /node_modules/ - 32 matches
Pattern: ".ut.js" - 0 matches
Done in 0.61s.

$ yarn jest '\.ut\.'  
yarn jest v0.24.6
$ "/home/goldylucks/apps/ci-workflow-workshop/node_modules/.bin/jest" \.ut\.
No tests found
In /home/goldylucks/apps/ci-workflow-workshop
  32 files checked.
  testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 1 match
  testPathIgnorePatterns: /node_modules/ - 32 matches
Pattern: ".ut." - 0 matches
Done in 0.60s.

您的问题是您只在测试套件中包含
(spec | test).js?x
文件吗?因此,
.ut.js
过滤器返回零结果,因为这些文件从一开始就没有被包含?我认为您需要的最佳模式是:
纱线笑话'\\\\\.ut\\.js$'
纱线笑话'\\\\\.ut\.js$'测试匹配src有效!谢谢你,汤姆