Merge pull request #167 from AnalyticalGraphicsInc/gulp4

Upgrade to gulp4
This commit is contained in:
Sean Lilley 2018-11-06 17:58:39 -05:00 committed by GitHub
commit 2fde781c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 12 deletions

View File

@ -22,7 +22,14 @@ process.env.PATH += environmentSeparator + nodeBinaries;
var specFiles = ['**/*.js', '!node_modules/**', '!coverage/**', '!doc/**', '!bin/**']; var specFiles = ['**/*.js', '!node_modules/**', '!coverage/**', '!doc/**', '!bin/**'];
gulp.task('test', function (done) { module.exports = {
test: test,
'test-watch': testWatch,
coverage: coverage,
cloc: cloc
};
function test(done) {
var jasmine = new Jasmine(); var jasmine = new Jasmine();
jasmine.loadConfigFile('specs/jasmine.json'); jasmine.loadConfigFile('specs/jasmine.json');
jasmine.addReporter(new JasmineSpecReporter({ jasmine.addReporter(new JasmineSpecReporter({
@ -32,10 +39,10 @@ gulp.task('test', function (done) {
jasmine.onComplete(function (passed) { jasmine.onComplete(function (passed) {
done(argv.failTaskOnError && !passed ? 1 : 0); done(argv.failTaskOnError && !passed ? 1 : 0);
}); });
}); }
gulp.task('test-watch', function () { function testWatch() {
gulp.watch(specFiles).on('change', function () { return gulp.watch(specFiles).on('change', function () {
// We can't simply depend on the test task because Jasmine // We can't simply depend on the test task because Jasmine
// does not like being run multiple times in the same process. // does not like being run multiple times in the same process.
try { try {
@ -46,9 +53,9 @@ gulp.task('test-watch', function () {
console.log('Tests failed to execute.'); console.log('Tests failed to execute.');
} }
}); });
}); }
gulp.task('coverage', function () { async function coverage() {
fsExtra.removeSync('coverage/server'); fsExtra.removeSync('coverage/server');
child_process.execSync('nyc' + child_process.execSync('nyc' +
' --all' + ' --all' +
@ -57,12 +64,12 @@ gulp.task('coverage', function () {
' -x "specs/**" -x "coverage/**" -x "doc/**" -x "bin/**" -x "index.js" -x "gulpfile.js"' + ' -x "specs/**" -x "coverage/**" -x "doc/**" -x "bin/**" -x "index.js" -x "gulpfile.js"' +
' node_modules/jasmine/bin/jasmine.js' + ' node_modules/jasmine/bin/jasmine.js' +
' JASMINE_CONFIG_PATH=specs/jasmine.json', { ' JASMINE_CONFIG_PATH=specs/jasmine.json', {
stdio: [process.stdin, process.stdout, process.stderr] stdio: [process.stdin, process.stdout, process.stderr]
}); });
open('coverage/lcov-report/index.html'); open('coverage/lcov-report/index.html');
}); }
gulp.task('cloc', function() { function cloc() {
var cmdLine; var cmdLine;
var clocPath = path.join('node_modules', 'cloc', 'lib', 'cloc'); var clocPath = path.join('node_modules', 'cloc', 'lib', 'cloc');
@ -98,4 +105,4 @@ gulp.task('cloc', function() {
}); });
}); });
}); });
}); }

View File

@ -39,7 +39,7 @@
"coveralls": "^3.0.2", "coveralls": "^3.0.2",
"eslint": "^5.6.1", "eslint": "^5.6.1",
"eslint-config-cesium": "^6.0.0", "eslint-config-cesium": "^6.0.0",
"gulp": "^3.9.1", "gulp": "^4.0.0",
"jasmine": "^3.2.0", "jasmine": "^3.2.0",
"jasmine-spec-reporter": "^4.2.1", "jasmine-spec-reporter": "^4.2.1",
"jsdoc": "^3.5.5", "jsdoc": "^3.5.5",