Skip to content

Commit fd31d78

Browse files
committed
Updates to unit test system and readme
1 parent c30d4be commit fd31d78

3 files changed

Lines changed: 38 additions & 1 deletion

File tree

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PACKAGE = libgit2
2+
NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node)
3+
4+
unittest:
5+
$(NODEJS) ./test/index.js test

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ framework installed.
1919
Unit testing
2020
------------
2121

22+
##### New way #####
23+
Ensure the submodules `nodeunit` and `rimraf` are located in the `/vendor` subdirectory. If they are not, run:
24+
git submodule init
25+
git submodule update
26+
27+
Then simply run `make unittest` in the project root.
28+
29+
Example of new method:
30+
[tim@thinkpad Projects]$ cd node-libgit2
31+
[tim@thinkpad node-libgit2]$ node-waf configure build
32+
[tim@thinkpad node-libgit2]$ make unittest
33+
34+
##### Old way #####
2235
node-libgit2 utilizes nodeunit `npm install nodeunit` or use `/vendor/nodeunit` to handle its tests in the
2336
`/test` folder. Example of running repo tests with vendor script:
2437
[tim@thinkpad Projects]$ cd node-libgit2

test/index.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
require('./test-repo.js');
1+
#!/usr/bin/env node
2+
3+
require.paths.unshift('../vendor');
4+
5+
try {
6+
var reporter = require('../vendor/nodeunit').reporters.default;
7+
}
8+
catch(e) {
9+
var sys = require('sys');
10+
sys.puts("Cannot find nodeunit module.");
11+
sys.puts("You can download submodules for this project by doing:");
12+
sys.puts("");
13+
sys.puts(" git submodule init");
14+
sys.puts(" git submodule update");
15+
sys.puts("");
16+
process.exit();
17+
}
18+
19+
process.chdir('./');
20+
reporter.run(['test']);

0 commit comments

Comments
 (0)