Permalink
Browse files

Updates to unit test system and readme

  • Loading branch information...
1 parent c30d4be commit fd31d789b42daf80abfff90ccc3d263f5624869a @tbranyen tbranyen committed Feb 18, 2011
Showing with 38 additions and 1 deletion.
  1. +5 −0 Makefile
  2. +13 −0 README.md
  3. +20 −1 test/index.js
View
@@ -0,0 +1,5 @@
+PACKAGE = libgit2
+NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
+
+unittest:
+ $(NODEJS) ./test/index.js test
View
@@ -19,6 +19,19 @@ framework installed.
Unit testing
------------
+##### New way #####
+Ensure the submodules `nodeunit` and `rimraf` are located in the `/vendor` subdirectory. If they are not, run:
+ git submodule init
+ git submodule update
+
+Then simply run `make unittest` in the project root.
+
+Example of new method:
+ [tim@thinkpad Projects]$ cd node-libgit2
+ [tim@thinkpad node-libgit2]$ node-waf configure build
+ [tim@thinkpad node-libgit2]$ make unittest
+
+##### Old way #####
node-libgit2 utilizes nodeunit `npm install nodeunit` or use `/vendor/nodeunit` to handle its tests in the
`/test` folder. Example of running repo tests with vendor script:
[tim@thinkpad Projects]$ cd node-libgit2
View
@@ -1 +1,20 @@
-require('./test-repo.js');
+#!/usr/bin/env node
+
+require.paths.unshift('../vendor');
+
+try {
+ var reporter = require('../vendor/nodeunit').reporters.default;
+}
+catch(e) {
+ var sys = require('sys');
+ sys.puts("Cannot find nodeunit module.");
+ sys.puts("You can download submodules for this project by doing:");
+ sys.puts("");
+ sys.puts(" git submodule init");
+ sys.puts(" git submodule update");
+ sys.puts("");
+ process.exit();
+}
+
+process.chdir('./');
+reporter.run(['test']);

0 comments on commit fd31d78

Please sign in to comment.