Skip to content
Browse files

Move example tests, which revealed runner problem

  • Loading branch information...
1 parent 35b796d commit 44173cc748e5a7b655b888e99c7ac9ae7c1cfdf1 @joelplane joelplane committed Jun 19, 2011
View
22 bin/testnode.js
@@ -15,15 +15,29 @@
var sys = require('sys');
var glob = require('glob');
var runner = require('../runner');
+var cwd = process.cwd();
var dirArg = process.ARGV[2];
-var dir;
+var dir = dirArg;
if (!dirArg) {
sys.puts("Usage: testnode TESTS_DIRECTORY");
process.exit(0);
}
-dir = (dirArg.charAt(dirArg.length-1)=='/') ? (dirArg + '**') : (dirArg + '/**');
-glob.glob(dir + '/**', null, function(error, files){
- runner.run(files);
+var dedup = function(array) {
+ var newArray = [];
+ var i;
+ for(i=0; i<array.length; i++) {
+ var value = array[i];
+ if (newArray.indexOf(value) == -1) {
+ newArray.push(value);
+ }
+ }
+ return newArray;
+};
+
+dir = dir.charAt(0) == '/' ? dir : cwd + '/' + dir;
+dir = (dir.charAt(dir.length-1)=='/') ? (dir + '**') : (dir + '/**');
+glob.glob(dir + '/**.js', null, function(error, files){
+ runner.run(dedup(files));
});
View
2 examples/asyncExample.js → examples/failing/asyncExample.js
@@ -1,4 +1,4 @@
-var test = require('../testnode')();
+var test = require('testnode')();
test.onFailureExitNonZero();
doSomethingAsychronously(function() {
View
2 examples/exceptionTest.js → examples/failing/exceptionTest.js
@@ -1,4 +1,4 @@
-var test = require('../testnode')();
+var test = require('testnode')();
test.onFailureExitNonZero();
test.context("Example Test Suite", function() {
View
2 examples/failingTest.js → examples/failing/failingTest.js
@@ -1,4 +1,4 @@
-var test = require('../testnode')();
+var test = require('testnode')();
test.onFailureExitNonZero();
test.context("Example Test Suite", function() {
View
2 examples/exceptionOutsideStackTest.js → ...les/hardfail/exceptionOutsideStackTest.js
@@ -1,4 +1,4 @@
-var test = require('../testnode')();
+var test = require('testnode')();
test.onFailureExitNonZero();
test.handleUncaughtExceptions();
View
2 examples/basicTest.js → examples/passing/basicTest.js
@@ -1,4 +1,4 @@
-var test = require('../testnode')();
+var test = require('testnode')();
test.onFailureExitNonZero();
test.context("Example Test Suite", function() {
View
2 examples/basicTest2.js → examples/passing/basicTest2.js
@@ -1,4 +1,4 @@
-var test = require('../testnode')();
+var test = require('testnode')();
test.onFailureExitNonZero();
test.context("Example Test Suite", function() {
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "testnode",
"description": "Testing library for Node",
- "version": "0.1.1",
+ "version": "0.1.2",
"dependencies" : {
"glob": "",
"ansi-color": ""
View
2 runner.js
@@ -5,7 +5,7 @@ module.exports = {
run: function(files) {
files.forEach(function(file){
sys.puts('Loading file ' + file);
- require('./' + file);
+ require(file);
});
}
};

0 comments on commit 44173cc

Please sign in to comment.
Something went wrong with that request. Please try again.