UNPKG

689 BJavaScriptView Raw
1#!/usr/bin/env node
2/* globals cd, echo, exec, exit, ls */
3require('../global');
4
5var failed = false;
6
7//
8// Unit tests
9//
10cd(__dirname + '/../test');
11ls('*.js').forEach(function(file) {
12 echo('Running test:', file);
13 if (exec(JSON.stringify(process.execPath)+' '+file).code !== 123) { // 123 avoids false positives (e.g. premature exit)
14 failed = true;
15 echo('*** TEST FAILED! (missing exit code "123")');
16 echo();
17 }
18});
19
20echo();
21
22if (failed) {
23 echo('*******************************************************');
24 echo('WARNING: Some tests did not pass!');
25 echo('*******************************************************');
26 exit(1);
27} else {
28 echo('All tests passed.');
29}