Я пытаюсь запустить модульные тесты и покрытие моего кода с помощью Gulp.
У меня есть следующие зависимости от моего package.json
:
"gulp": "^4.0.2",
"gulp-coverage": "^0.3.38",
"gulp-mocha": "^7.0.2",
И у меня есть следующее gulpfile:
gulp = require('gulp');
mocha = require('gulp-mocha');
cover = require('gulp-coverage');
gulp.task('test', function () {
return gulp.src('test/**/*.js', { read: false })
.pipe(cover.instrument({
pattern: ['src/**/*.js'],
debugDirectory: 'debug'
}))
.pipe(mocha())
.pipe(cover.gather())
.pipe(cover.format())
.pipe(gulp.dest('reports'))
});
Теперь, когда я запускаю gulp test
, тесты запускаются, но покрытие не выполняется:
C:\Users\mparn\Documents\GitHub\node-cognitive-services (master) (cognitive-se
rvices@1.2.3)
λ gulp test
[21:03:19] Using gulpfile ~\Documents\GitHub\node-cognitive-services\gulpfile.
js
[21:03:19] Starting 'test'...
API Test
√ should throw an error if a body parameter is required for json and not p
resent
√ should throw an error if the boolean body parameter has a value other th
an true or false
√ should throw an error if a body parameter is required and its value is n
ot in the list of options
√ should throw an error if a parameter is required and not present
√ should throw an error if more than one parameter is required but not pre
sent
√ should throw an error if a parameter is required and its value is not in
the list of options
√ should accept a list of options for parameters
√ should throw an error if the boolean parameter has a value other than tr
ue or false
√ should not throw an error if the endpoint is supported
√ should throw an error if the endpoint is not supported
√ should throw an error if a header is required but not present
√ should throw an error if more than one headers are required but not pres
ent
12 passing (9ms)
[21:03:22] 'test' errored after 3.51 s
[21:03:22] Error: Received a non-Vinyl object in `dest()`
at DestroyableTransform.normalize [as _transform] (C:\Users\mparn\Document
s\GitHub\node-cognitive-services\node_modules\vinyl-fs\lib\dest\prepare.js:16:
17)
at DestroyableTransform.Transform._read (C:\Users\mparn\Documents\GitHub\n
ode-cognitive-services\node_modules\readable-stream\lib\_stream_transform.js:1
82:10)
at DestroyableTransform.Transform._write (C:\Users\mparn\Documents\GitHub\
node-cognitive-services\node_modules\readable-stream\lib\_stream_transform.js:
170:83)
at doWrite (C:\Users\mparn\Documents\GitHub\node-cognitive-services\node_m
odules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (C:\Users\mparn\Documents\GitHub\node-cognitive-services\
node_modules\readable-stream\lib\_stream_writable.js:395:5)
at DestroyableTransform.Writable.write (C:\Users\mparn\Documents\GitHub\no
de-cognitive-services\node_modules\readable-stream\lib\_stream_writable.js:322
:11)
at Pumpify.Duplexify._write (C:\Users\mparn\Documents\GitHub\node-cognitiv
e-services\node_modules\duplexify\index.js:208:22)
at doWrite (C:\Users\mparn\Documents\GitHub\node-cognitive-services\node_m
odules\readable-stream\lib\_stream_writable.js:406:64)
at writeOrBuffer (C:\Users\mparn\Documents\GitHub\node-cognitive-services\
node_modules\readable-stream\lib\_stream_writable.js:395:5)
at Pumpify.Writable.write (C:\Users\mparn\Documents\GitHub\node-cognitive-
services\node_modules\readable-stream\lib\_stream_writable.js:322:11)