在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):sindresorhus/gulp-mocha开源软件地址(OpenSource Url):https://github.com/sindresorhus/gulp-mocha开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-mocha
Keep in mind that this is just a thin wrapper around Mocha and your issue is most likely with Mocha. Install
Usageconst gulp = require('gulp');
const mocha = require('gulp-mocha');
exports.default = () => (
gulp.src('test.js', {read: false})
// `gulp-mocha` needs filepaths so you can't have any plugins before it
.pipe(mocha({reporter: 'nyan'}))
); APImocha(options?)optionsType: Options are passed directly to the uiType: Interface to use. reporterType: Reporter that will be used. This option can also be used to utilize third-party reporters. For example, if you reporterOptionsType: Reporter specific options. globalsType: List of accepted global variable names, example timeoutType: Test-case timeout in milliseconds. bailType: Bail on the first test failure. checkLeaksType: Check for global variable leaks. grepType: Only run tests matching the given pattern which is internally compiled to a RegExp. requireType: Require custom modules before tests are run. compilersType: Specify a compiler. FAQTest suite not exitingIf your test suite is not exiting it might be because you still have a lingering callback, most often caused by an open database connection. You should close this connection or do the following: exports.default = () => (
gulp.src('test.js')
.pipe(mocha())
.once('error', err => {
console.error(err);
process.exit(1);
})
.once('end', () => {
process.exit();
})
); Or you might just need to pass the exports.test = () => (
gulp.src(['test/**/*.js'], {read: false})
.pipe(mocha({reporter: 'list', exit: true}))
.on('error', console.error)
); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论