Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
coveragePost() {
chai.should();
// chai.use(require("sinon-chai"));
// chai.use(require("chai-as-promised"));
return gulp.src([
"./build/compiled/test/functional/**/*.js",
"./build/compiled/test/issues/**/*.js",
])
.pipe(mocha())
.pipe(istanbul.writeReports());
}
function runner() {
return gulp
.src(testGlob)
.pipe(mocha(mochaOpts))
// .on('error', function (err) {
// gutil.log(err);
// this.emit('end');
// })
.pipe(istanbul.writeReports())
.on('end', cb);
}
gulp.task('test', ['pre-test'], function () {
// Everything file loaded from here uses babel with .babelrc
require('babel-core/register'); // https://babeljs.io/docs/usage/require/
return gulp.src(specs, {read: false})
.pipe(mocha())
.pipe(istanbul.writeReports())
// Enforce a coverage of at least 90%
.pipe(istanbul.enforceThresholds({thresholds: {global: 75}}));
});
.on('finish', function () {
return gulp.src(testSourceFiles)
.pipe(mocha())
.on('error', gutil.log)
.pipe(istanbul.writeReports()) // Creating the reports after tests ran
.pipe(istanbul.enforceThresholds({thresholds: {global: 95}})) // Enforce a coverage of at least 100%
.on('end', done);
})
.on('error', gutil.log);
public executeTask(gulp: typeof Gulp, completeCallback?: (error?: string) => void): NodeJS.ReadWriteStream {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const istanbul: typeof gulpIstanbul = require('gulp-istanbul');
return gulp.src(this.taskConfig.coverageMatch)
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire())
// Write the covered files to a temporary directory
.pipe(gulp.dest(this.buildConfig.tempFolder));
}
}
coveragePost() {
chai.should();
chai.use(require("sinon-chai"));
chai.use(require("chai-as-promised"));
return gulp.src(["./build/compiled/test/**/*.js"])
.pipe(mocha())
.pipe(istanbul.writeReports());
}
function test() {
gulp.src(['./test/**/*.js'], { read: false })
.pipe(mocha())
.pipe(istanbul.writeReports({
dir: 'test-coverage/',
reportOpts: {
dir: 'test-coverage/'
},
reporters: ['lcov', 'text', 'text-summary', 'cobertura']
}))
.pipe(istanbul.enforceThresholds({ thresholds: { global: 1 } }));
return gulp.src('test-coverage/lcov.info')
.pipe(coveralls());
}
function test() {
gulp.src(['./test/**/*.js'], { read: false }).pipe(mocha()).pipe(istanbul.writeReports({
dir: 'test-coverage/',
reportOpts: {
dir: 'test-coverage/'
},
reporters: ['lcov', 'text', 'text-summary', 'cobertura']
})).pipe(istanbul.enforceThresholds({ thresholds: { global: 1 } }));
return gulp.src('test-coverage/lcov.info').pipe(coveralls());
}
gulp.task('test', function test(coverage) {
gulp.src('app/*.js')
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire())
.on('finish', function() {
gulp.src(['test/*.js'])
.pipe(jasmine())
.pipe(istanbul.writeReports())
.on('end', coverage);
});
});
gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;
gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function () {
cb(mochaErr);
});
});