Permalink
Browse files

qunit with phantom setup

  • Loading branch information...
1 parent 62aa9a5 commit c06abd4a06bf8fc3f7b96e5afeefd2af4d58b3ac @johnbender johnbender committed May 22, 2012
Showing with 28 additions and 3 deletions.
  1. +22 −1 build/config.js
  2. +3 −0 grunt.js
  3. +3 −2 package.json
View
@@ -1,6 +1,7 @@
var fs = require( 'fs' ),
path = require( 'path' ),
- child_process = require( 'child_process' );
+ child_process = require( 'child_process' ),
+ glob = require( 'glob-whatev' );
module.exports = function( grunt ) {
var global = {
@@ -99,5 +100,25 @@ module.exports = function( grunt ) {
}
};
+ grunt.registerTask( 'test_config', 'glob all the test files', function() {
+ var done = this.async(), test_paths, server_paths = [];
+
+ test_paths = glob.glob( 'tests/unit/*/' );
+ test_paths = test_paths.concat( glob.glob('tests/unit/**/*-tests.html') );
+ test_paths.forEach( function( file_path ) {
+ var final_path = process.env.ROOT_DOMAIN + file_path;
+
+ // if no test path is defined or if the path matches that specified in the env
+ // add it to the config
+ if( !process.env.TEST_PATH || file_path.indexOf(process.env.TEST_PATH) >= 0 ) {
+ server_paths.push( final_path );
+ }
+ });
+
+ grunt.config.set( 'qunit', { all: server_paths });
+
+ done();
+ });
+
grunt.config.set( 'global', global );
};
View
@@ -48,6 +48,9 @@ module.exports = function( grunt ) {
// set the default task.
grunt.registerTask('default', 'lint');
+ // A convenient task alias.
+ grunt.registerTask('test', 'test_config qunit');
+
// load the project wide config before loading the tasks
require( path.resolve(path.join('build', 'config')) )( grunt );
View
@@ -12,8 +12,9 @@
},
"dependencies": {
"grunt": "0.3.x",
- "requirejs": "1.0.8",
- "sqwish": "0.2.0"
+ "requirejs": "1.0.8",
+ "sqwish": "0.2.0",
+ "glob-whatev": "~0.1.4"
},
"engine": {
"node": ">=6.0"

0 comments on commit c06abd4

Please sign in to comment.