Skip to content

Commit

Permalink
Added node tests to Gulpfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesshore committed Jan 12, 2014
1 parent 1e9e4e5 commit 2e79c01
Show file tree
Hide file tree
Showing 53 changed files with 5,691 additions and 25 deletions.
54 changes: 29 additions & 25 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
"use strict";

var gulp = require("gulp");
var glob = require("glob");

var jshint = require("gulp-jshint");
var nodeunit = require("./build/util/nodeunit_runner.js");

gulp.task("default", ["lint"], function() {
gulp.task("default", ["lint", "test"], function() {
console.log("\n\nOK");
});

Expand All @@ -22,6 +25,19 @@ gulp.task("lintClient", function() {
.pipe(jshint.reporter('default'));
});

gulp.task("test", ["testNode", "testClient"]);

gulp.task("testNode", function(done) {
nodeFilesToTest(function(err, files) {
if (err) return done(err);
nodeunit.runTests(files, done, done);
});
});

gulp.task("testClient", function() {
console.log("TBD");
});

//var lint = require("./build/util/lint_runner.js");
//var nodeunit = require("./build/util/nodeunit_runner.js");
//var karma = require("./build/util/karma_runner.js");
Expand Down Expand Up @@ -65,30 +81,18 @@ gulp.task("lintClient", function() {
//task("testClient", function() {
// karma.runTests(REQUIRED_BROWSERS, complete, fail);
//}, {async: true});
//
//function nodeFilesToTest() {
// var testFiles = new jake.FileList();
// testFiles.include("src/_*_test.js");
// testFiles.include("src/server/**/_*_test.js");
// var tests = testFiles.toArray();
// return tests;
//}
//
//function nodeFilesToLint() {
// var files = new jake.FileList();
// files.include("src/*.js");
// files.include("src/server/**/*.js");
// files.include("build/util/**/*.js");
// files.include("Jakefile.js");
// files.include("Gruntfile.js");
// return files.toArray();
//}
//
//function browserFilesToLint() {
// var files = new jake.FileList();
// files.include("src/client/**/*.js");
// return files.toArray();
//}

function nodeFilesToTest(callback) {
glob("src/_*_test.js", function(err, srcFiles) {
if (err) return callback(err);

glob("src/server/**/_*_test.js", function(err2, serverFiles) {
if (err2) return callback(err2);

callback(null, srcFiles.concat(serverFiles));
});
});
}

function globalLintOptions() {
return {
Expand Down
2 changes: 2 additions & 0 deletions node_modules/glob/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions node_modules/glob/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions node_modules/glob/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

250 changes: 250 additions & 0 deletions node_modules/glob/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/glob/examples/g.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/glob/examples/usr-local.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2e79c01

Please sign in to comment.