gulp-npm-test 运行 Jest 测试(全部通过),但声称失败

gulp-npm-test running Jest tests (all passing), but claiming to fail

我在 documentation 之后安装了 gulp-npm-test,也就是说,在我的 gulp 目录中,我有一个文件 test.js,如下所示:

var gulp = require('gulp')
require('gulp-npm-test')(gulp)

var gulp = require('gulp-npm-test')(gulp, {
  withoutNpmRun: false
})

但是当我 运行 gulp test 我得到如下输出:

[17:12:41] Using gulpfile ~/my-project/gulpfile.js
[17:12:41] Starting 'test'...

> my-project@0.0.1 test /Users/wogsland/my-project
> jest

 PASS  frontend/tests/components/atoms/InputText.test.js
 .
 .
 (many more Jest test passes, no fails)
 .
 .
 FAIL  gulp/tasks/test.js
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at onResult (node_modules/jest/node_modules/jest-cli/build/TestRunner.js:192:18)

Test Suites: 1 failed, 135 passed, 136 total
Tests:       135 passed, 135 total
Snapshots:   209 passed, 209 total
Time:        92.237s
Ran all test suites.
npm ERR! Test failed.  See above for more details.

我在这里错过了什么?我做了很多测试

看起来像是找出哪些文件是测试的匹配器,匹配文件名 test.js 中包含的所有内容。默认值为 [ '**/__tests__/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)' ]。所以要么调整这个,它 testMatch in your jest settings. Or use testPathIgnorePatterns 排除 /gulp 文件夹。