@samitouri / QOS-React-2 / commits / 2220f0478c

Drastically improve test performance

petehunt committed Apr 12, 2014 at 21:05 UTC 2220f0478cf5ba520e06bc12e6bce74dd6b5b3dd
2 files changed +35 -20
Gruntfile.js
+8 -1
@@ -20,7 +20,7 @@ module.exports = function(grunt) {
20 copy: require('./grunt/config/copy'),
21 jsx: require('./grunt/config/jsx'),
22 browserify: require('./grunt/config/browserify'),
23 - populist: require('./grunt/config/populist'),
23 + populist: require('./grunt/config/populist')(grunt),
24 connect: require('./grunt/config/server')(grunt),
25 "webdriver-jasmine": require('./grunt/config/webdriver-jasmine'),
26 "webdriver-perf": require('./grunt/config/webdriver-perf'),
@@ -179,6 +179,13 @@ module.exports = function(grunt) {
179 'test:webdriver:phantomjs',
180 'coverage:parse'
181 ]);
182 + grunt.registerTask('fasttest', function() {
183 + if (grunt.option('debug')) {
184 + grunt.task.run('build:test', 'connect:server:keepalive');
185 + } else {
186 + grunt.task.run('build:test', 'test:webdriver:phantomjs');
187 + }
188 + });
189 grunt.registerTask('test', function() {
190 if (grunt.option('debug')) {
191 grunt.task.run('build:test', 'build:basic', 'connect:server:keepalive');
grunt/config/populist.js
+27 -19
@@ -1,24 +1,32 @@
1 'use strict';
2
3 -var jasmine = {
4 - rootDirectory: "build/jasmine",
5 - // This syntax means to require and expose the "jasmine" module
6 - // (build/jasmine/jasmine.js) as global.jasmine, and to require the
7 - // "all" module (build/jasmine/all.js) but not expose it globally.
8 - args: ["jasmine:jasmine", "all:"],
9 - outfile: "./build/jasmine.js"
10 -};
3 +module.exports = function(grunt) {
4 + var jasmine = {
5 + rootDirectory: "build/jasmine",
6 + // This syntax means to require and expose the "jasmine" module
7 + // (build/jasmine/jasmine.js) as global.jasmine, and to require the
8 + // "all" module (build/jasmine/all.js) but not expose it globally.
9 + args: ["jasmine:jasmine", "all:"],
10 + outfile: "./build/jasmine.js"
11 + };
12
12 -var test = {
13 - rootDirectory: "build/modules",
14 - args: ["test/all:harness"],
15 - requires: [
16 - "**/__tests__/*-test.js"
17 - ],
18 - outfile: './build/react-test.js'
19 -};
13 + var filterExpr = grunt.option('filter');
14 +
15 + if (filterExpr) {
16 + filterExpr = '**/__tests__/' + filterExpr + '-test.js';
17 + } else {
18 + filterExpr = '**/__tests__/*-test.js';
19 + }
20 +
21 + var test = {
22 + rootDirectory: "build/modules",
23 + args: ["test/all:harness"],
24 + requires: [filterExpr],
25 + outfile: './build/react-test.js'
26 + };
27
21 -module.exports = {
22 - jasmine: jasmine,
23 - test: test
28 + return {
29 + jasmine: jasmine,
30 + test: test
31 + };
32 };