Permalink
Browse files

split command line code out of testrunner and move to cli module

  • Loading branch information...
caolan committed Sep 28, 2010
1 parent a18102c commit c999ec3cc3953f2a0fd986047d863c59607ce830
Showing with 24 additions and 29 deletions.
  1. +1 −1 Makefile
  2. +0 −3 bin/nodeunit
  3. +21 −0 lib/cli.js
  4. +0 −23 lib/testrunner.js
  5. +2 −2 package.json
View
@@ -20,7 +20,7 @@ stamp-build: $(wildcard deps/* lib/*.js)
mkdir -p $(BUILDDIR)/nodeunit
cp -R deps lib/*.js $(BUILDDIR)/nodeunit
find $(BUILDDIR)/nodeunit/ -type f | xargs sed -i 's/\.\.\/deps/.\/deps/'
- printf '#!/bin/sh\n$(NODEJS) $(NODEJSLIBDIR)/$(PACKAGE)/testrunner.js $$@' > $(BUILDDIR)/nodeunit.sh
+ printf '#!/bin/sh\n$(NODEJS) $(NODEJSLIBDIR)/$(PACKAGE)/cli.js $$@' > $(BUILDDIR)/nodeunit.sh
printf "module.exports = require('$(PACKAGE)/nodeunit')" > $(BUILDDIR)/nodeunit.js
test:
View
@@ -1,3 +0,0 @@
-#!/bin/sh
-REALPATH=`readlink -f $0`
-node `dirname $REALPATH`/../lib/testrunner.js $@
View
@@ -0,0 +1,21 @@
+var testrunner = require('./testrunner'),
+ fs = require('fs');
+
+require.paths.push(process.cwd());
+var args = process.ARGV.slice(2);
+
+// load package.json and read version number
+if (args.length === 1 && (args[0] === '-v' || args[0] === '--version')) {
+ fs.readFile(__dirname + '/../package.json', function (err, content) {
+ if (err) {
+ throw err;
+ }
+ else {
+ var pkg = JSON.parse(content);
+ console.log(pkg.version);
+ }
+ });
+ return;
+}
+
+testrunner.run(args);
View
@@ -9,7 +9,6 @@
*/
var nodeunit = require('./nodeunit'),
- fs = require('fs'),
sys = require('sys'),
path = require('path');
@@ -75,25 +74,3 @@ exports.run = function (files) {
}
});
};
-
-// If this is run from the command-line:
-if (module.id === '.') {
- require.paths.push(process.cwd());
- var args = process.ARGV.slice(2);
-
- // load package.json and read version number
- if (args.length === 1 && (args[0] === '-v' || args[0] === '--version')) {
- fs.readFile(__dirname + '/../package.json', function (err, content) {
- if (err) {
- throw err;
- }
- else {
- var pkg = JSON.parse(content);
- console.log(pkg.version);
- }
- });
- return;
- }
-
- exports.run(args);
-}
View
@@ -2,7 +2,7 @@
, "description": "Easy unit testing in node.js, loosely based on the QUnit API"
, "main": "./index"
, "author": "Caolan McMahon"
-, "version": "0.2.2"
+, "version": "0.2.3"
, "repository" :
{ "type" : "git"
, "url" : "http://github.com/caolan/nodeunit.git"
@@ -13,5 +13,5 @@
, "url" : "http://github.com/caolan/nodeunit/raw/master/LICENSE"
}
]
- , "bin" : { "nodeunit" : "./lib/testrunner.js" }
+ , "bin" : { "nodeunit" : "./lib/cli.js" }
}

0 comments on commit c999ec3

Please sign in to comment.