]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Gulp command switch to run specific test files
authorSimon Brunel <simonbrunel@users.noreply.github.com>
Fri, 23 Sep 2016 15:42:56 +0000 (17:42 +0200)
committerSimon Brunel <simonbrunel@users.noreply.github.com>
Fri, 23 Sep 2016 15:47:33 +0000 (17:47 +0200)
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).

gulpfile.js
package.json

index b3dab98d11a3b3583a8d8897c62efc078b241775..f4a25cf2ff8adedd89908daa0c1f0761494ab9c1 100644 (file)
@@ -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() {
index e901b26c3f1381343f4565a5008f130b17d43f58..4d2bb804288ce2b44085e9a59c2fa9cd2990fc82 100644 (file)
@@ -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"