简体   繁体   中英

gulp-mocha issue in WebStorm

I am trying to run tests in WebStorm using gulp-mocha. The tests are transpiled from TypeScript. I am running the standard WebStorm configuration to run gulp using node as the interpreter.

Gulp file:

var gulp = require('gulp'); var mocha = require('gulp-mocha');

gulp.task('default', function () {
    return gulp.src('app/**/*-spec.js', {read: false})
        // gulp-mocha needs filepaths so you can't have any plugins before it
        .pipe(mocha({reporter: 'nyan'})); });

Error:

"C:\\Program Files (x86)\\JetBrains\\WebStorm 11.0.2\\bin\\runnerw.exe" "C:\\Program Files\\nodejs\\node.exe" C:\\Users\\us1\\AppData\\Roaming\\npm\\node_modules\\gulp\\bin\\gulp.js --color --gulpfile c:\\dev\\angular-scheduler\\gulpfile.js default [13:33:22] Using gulpfile c:\\dev\\angular-scheduler\\gulpfile.js [13:33:22] Starting 'default'... [13:33:22] 'default' errored after 32 ms [13:33:22] ReferenceError in plugin 'gulp-mocha' Message: System is not defined Stack: ReferenceError: System is not defined at Object. (c:\\dev\\angular-scheduler\\app\\classes\\builders\\CalBuilder-spec.js:1:63) at Module._compile (module.js:425:26) at Object.Module._extensions..js (module.js:432:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17) at c:\\dev\\angular-scheduler\\node_modules\\mocha\\lib\\mocha.js:216:27 at Array.forEach (native) at Mocha.loadFiles (c:\\dev\\angular-scheduler\\node_modules\\mocha\\lib\\mocha.js:213:14)

Process finished with exit code 1

Any help would be much appreciated.

我通过在tsc设置中使用commonjs而不是systemjs来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM