我已经gulp-npm-test
跟随他们documentation,也就是说,在我的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.
我在这里缺少什么?我已经进行了一系列测试
答案 0 :(得分:1)
看起来匹配器确定哪些文件是测试,匹配文件名test.js
中包含的所有内容。默认值为[ '**/__tests__/**/*.js?(x)', '**/?(*.)(spec|test).js?(x)' ]
。因此要么调整这一个,要在你的jest设置中调整testMatch
。或使用testPathIgnorePatterns
排除/gulp
文件夹。