Skip to content

Commit

Permalink
Drastically improve test performance
Browse files Browse the repository at this point in the history
  • Loading branch information
petehunt committed Apr 14, 2014
1 parent b9c50ee commit 2220f04
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
9 changes: 8 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function(grunt) {
copy: require('./grunt/config/copy'),
jsx: require('./grunt/config/jsx'),
browserify: require('./grunt/config/browserify'),
populist: require('./grunt/config/populist'),
populist: require('./grunt/config/populist')(grunt),
connect: require('./grunt/config/server')(grunt),
"webdriver-jasmine": require('./grunt/config/webdriver-jasmine'),
"webdriver-perf": require('./grunt/config/webdriver-perf'),
Expand Down Expand Up @@ -179,6 +179,13 @@ module.exports = function(grunt) {
'test:webdriver:phantomjs',
'coverage:parse'
]);
grunt.registerTask('fasttest', function() {
if (grunt.option('debug')) {
grunt.task.run('build:test', 'connect:server:keepalive');
} else {
grunt.task.run('build:test', 'test:webdriver:phantomjs');
}
});
grunt.registerTask('test', function() {
if (grunt.option('debug')) {
grunt.task.run('build:test', 'build:basic', 'connect:server:keepalive');
Expand Down
46 changes: 27 additions & 19 deletions grunt/config/populist.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
'use strict';

var jasmine = {
rootDirectory: "build/jasmine",
// This syntax means to require and expose the "jasmine" module
// (build/jasmine/jasmine.js) as global.jasmine, and to require the
// "all" module (build/jasmine/all.js) but not expose it globally.
args: ["jasmine:jasmine", "all:"],
outfile: "./build/jasmine.js"
};
module.exports = function(grunt) {
var jasmine = {
rootDirectory: "build/jasmine",
// This syntax means to require and expose the "jasmine" module
// (build/jasmine/jasmine.js) as global.jasmine, and to require the
// "all" module (build/jasmine/all.js) but not expose it globally.
args: ["jasmine:jasmine", "all:"],
outfile: "./build/jasmine.js"
};

var test = {
rootDirectory: "build/modules",
args: ["test/all:harness"],
requires: [
"**/__tests__/*-test.js"
],
outfile: './build/react-test.js'
};
var filterExpr = grunt.option('filter');

if (filterExpr) {
filterExpr = '**/__tests__/' + filterExpr + '-test.js';
} else {
filterExpr = '**/__tests__/*-test.js';
}

var test = {
rootDirectory: "build/modules",
args: ["test/all:harness"],
requires: [filterExpr],
outfile: './build/react-test.js'
};

module.exports = {
jasmine: jasmine,
test: test
return {
jasmine: jasmine,
test: test
};
};

0 comments on commit 2220f04

Please sign in to comment.