Last change
on this file since 484 was
484,
checked in by hendrikvanantwerpen, 11 years ago
|
Commit node_modules, to make checkouts and builds more deterministic.
|
File size:
880 bytes
|
Line | |
---|
1 | var spawn = require('child_process').spawn |
---|
2 | , exitCode = 0 |
---|
3 | , timeout = 10000 |
---|
4 | , fs = require('fs') |
---|
5 | ; |
---|
6 | |
---|
7 | fs.readdir(__dirname, function (e, files) { |
---|
8 | if (e) throw e |
---|
9 | |
---|
10 | var tests = files.filter(function (f) {return f.slice(0, 'test-'.length) === 'test-'}) |
---|
11 | |
---|
12 | var next = function () { |
---|
13 | if (tests.length === 0) process.exit(exitCode); |
---|
14 | |
---|
15 | var file = tests.shift() |
---|
16 | console.log(file) |
---|
17 | var proc = spawn('node', [ 'tests/' + file ]) |
---|
18 | |
---|
19 | var killed = false |
---|
20 | var t = setTimeout(function () { |
---|
21 | proc.kill() |
---|
22 | exitCode += 1 |
---|
23 | console.error(file + ' timeout') |
---|
24 | killed = true |
---|
25 | }, timeout) |
---|
26 | |
---|
27 | proc.stdout.pipe(process.stdout) |
---|
28 | proc.stderr.pipe(process.stderr) |
---|
29 | proc.on('exit', function (code) { |
---|
30 | if (code && !killed) console.error(file + ' failed') |
---|
31 | exitCode += code || 0 |
---|
32 | clearTimeout(t) |
---|
33 | next() |
---|
34 | }) |
---|
35 | } |
---|
36 | next() |
---|
37 | |
---|
38 | }) |
---|
39 | |
---|
40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.