Permalink
Browse files

added a Makefile for running tests and installing or uninstalling the…

… command-line tool
  • Loading branch information...
1 parent 24a92b6 commit e144ede4ff5fa8f0f65be8b394398de03d52b034 @caolan committed Sep 18, 2010
Showing with 40 additions and 17 deletions.
  1. +14 −0 Makefile
  2. +22 −2 README.md
  3. +3 −8 bin/nodeunit
  4. +1 −1 package.json
  5. +0 −6 test.js
View
14 Makefile
@@ -0,0 +1,14 @@
+PREFIX ?= /usr/local
+
+test:
+ ./bin/nodeunit test
+
+install:
+ cp -r ./ $(PREFIX)/lib/nodeunit
+ ln -s $(PREFIX)/lib/nodeunit/bin/nodeunit $(PREFIX)/bin/nodeunit
+
+uninstall:
+ rm -rf $(PREFIX)/lib/nodeunit
+ rm -f $(PREFIX)/bin/nodeunit
+
+.PHONY: test install uninstall
View
24 README.md
@@ -248,6 +248,26 @@ However, the module test-base.js first does some basic tests using the assert
module to ensure that test functions are actually run, and a basic level of
nodeunit functionality is available.
-To run the nodeunit tests do: node test.js
+To run the nodeunit tests do:
+
+ make test
-__Note:__ The tests hang when using node v0.2.0, upgrading to v0.2.1 fixes this.
+__Note:__ There was a bug in node v0.2.0 causing the tests to hang, upgrading
+to v0.2.1 fixes this.
+
+
+Installing the command-line tool
+--------------------------------
+
+If you have installed nodeunit via npm, the command line tool should already be
+available. Otherwise you can do:
+
+ make install
+
+to install nodeunit to /usr/local. You can then use nodeunit on the command-line:
+
+ nodeunit PATH
+
+To uninstall nodeunit, do:
+
+ make uninstall
View
11 bin/nodeunit
@@ -1,8 +1,3 @@
-#!/usr/bin/env node
-
-var path = require('path');
-var fs = require('fs');
-var lib = path.join(__dirname, '../lib');
-
-var testrunner = require(lib + '/testrunner.js');
-testrunner.run(process.argv.slice(2));
+#!/bin/sh
+REALPATH=`readlink -f $0`
+node `dirname $REALPATH`/../lib/testrunner.js $@
View
2 package.json
@@ -13,5 +13,5 @@
, "url" : "http://github.com/caolan/nodeunit/raw/master/LICENSE"
}
]
- , "bin" : { "nodeunit" : "./bin/nodeunit" }
+ , "bin" : { "nodeunit" : "./lib/testrunner" }
}
View
6 test.js
@@ -1,6 +0,0 @@
-#!/usr/bin/env node
-
-var testrunner = require('./lib/nodeunit').testrunner;
-
-process.chdir(__dirname);
-testrunner.run(['test']);

0 comments on commit e144ede

Please sign in to comment.