From: Simon Brunel Date: Fri, 23 Sep 2016 15:42:56 +0000 (+0200) Subject: Gulp command switch to run specific test files X-Git-Tag: v2.4.0~1^2~45^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ec7ce2f93a731d53c9330b7ef900a72367ac7aa;p=thirdparty%2FChart.js.git Gulp command switch to run specific test files Add the --inputs command switch to the unittest and unittestWatch tasks, to be able to run unit tests from the specified files only (e.g. gulp unittest --inputs=test/core.element.tests.js;test/core.helpers.tests.js). --- diff --git a/gulpfile.js b/gulpfile.js index b3dab98d1..f4a25cf2f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,6 +17,7 @@ var browserify = require('browserify'); var source = require('vinyl-source-stream'); var merge = require('merge-stream'); var collapse = require('bundle-collapser/plugin'); +var argv = require('yargs').argv var package = require('./package.json'); var srcDir = './src/'; @@ -33,11 +34,10 @@ var header = "/*!\n" + " */\n"; var preTestFiles = [ - './node_modules/moment/min/moment.min.js', + './node_modules/moment/min/moment.min.js' ]; var testFiles = [ - './test/mockContext.js', './test/*.js', // Disable tests which need to be rewritten based on changes introduced by @@ -157,10 +157,13 @@ function validHTMLTask() { } function startTest() { - var files = ['./src/**/*.js']; - Array.prototype.unshift.apply(files, preTestFiles); - Array.prototype.push.apply(files, testFiles); - return files; + return [].concat(preTestFiles).concat([ + './src/**/*.js', + './test/mockContext.js' + ]).concat( + argv.inputs? + argv.inputs.split(';'): + testFiles); } function unittestTask() { diff --git a/package.json b/package.json index e901b26c3..4d2bb8042 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "karma-jasmine": "^0.3.6", "karma-jasmine-html-reporter": "^0.1.8", "merge-stream": "^1.0.0", - "vinyl-source-stream": "^1.1.0" + "vinyl-source-stream": "^1.1.0", + "yargs": "^5.0.0" }, "spm": { "main": "Chart.js"