sindresorhus / gulp-mocha

Run Mocha tests
MIT License
375 stars 91 forks source link

DeprecationWarning: “--compilers” will be removed in a future version of Mocha #192

Closed pavel-castornii closed 5 years ago

pavel-castornii commented 5 years ago

I run mocha via gulp. This is my code:

import mocha from 'gulp-mocha';
...
return gulp.src([testFile], { read: false })
    .pipe(mocha({
        reporter: 'spec',
        compilers: [
            'js:babel-core/register',
        ]
}));

The problem is I get this annoying message:

(node:10357) DeprecationWarning: "--compilers" will be removed in a future version of Mocha; see https://git.io/vdcSr for more info

According to information here I can use --no-deprecation flag. But I can' understand how to add this flag to gulp-moch and could find a way in gulp-mocha package. Can anyone say how to fix it?

samsontesfay commented 5 years ago

you can use 'require' instead of 'compilers' option

import mocha from 'gulp-mocha'; ... return gulp.src([testFile], { read: false }) .pipe(mocha({ reporter: 'spec', require: [ 'babel-core/register', ] }));

pavel-castornii commented 5 years ago

@samsontesfay Thank you very much. Your solution helped.