]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Support grunt test --only=moment/duration,locale/ru
authorIskren Chernev <iskren.chernev@gmail.com>
Wed, 8 Jul 2015 13:24:15 +0000 (21:24 +0800)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 13 Jul 2015 00:42:10 +0000 (17:42 -0700)
tasks/qtest.js

index dc942a12ac25d4dd359cfccf3051ca86bed70c8e..a212087fb02a7ab62eb9abef6953dd16bcfa4bc6 100644 (file)
@@ -10,10 +10,26 @@ module.exports = function (grunt) {
         testrunner.options.log.testing = false;
         testrunner.options.maxBlockDuration = 120000;
 
+        var tests;
+
+        if (grunt.option("only") != null) {
+            tests = grunt.file.expand.apply(null, grunt.option('only').split(',').map(function (file) {
+                if (file === 'moment') {
+                    return 'build/umd/test/moment/*.js';
+                } else if (file === 'locale') {
+                    return 'build/umd/test/locale/*.js';
+                } else {
+                    return 'build/umd/test/' + file + '.js';
+                }
+            }));
+        } else {
+            tests = grunt.file.expand('build/umd/test/moment/*.js',
+                'build/umd/test/locale/*.js');
+        }
+
         testrunner.run({
             code: 'build/umd/moment.js',
-            tests: grunt.file.expand('build/umd/test/moment/*.js',
-                    'build/umd/test/locale/*.js')
+            tests: tests
         }, function (err, report) {
             if (err) {
                 console.log('woot', err, report);