Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 'npm test' run on Windows (#820)
- Loading branch information
1 parent
3b8e519
commit 3f4f5ca
Showing
3 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
|
||
TESTS = $(shell find test/test.*.js) | ||
|
||
test: | ||
@./test/run $(TESTS) | ||
@./test/run.js | ||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env node | ||
|
||
const { spawnSync } = require('child_process') | ||
const { readdirSync } = require('fs') | ||
const { extname, join } = require('path') | ||
|
||
process.env.NODE_ENV = 'test'; | ||
|
||
process.stdout.write('\n') | ||
readdirSync(__dirname).forEach((file) => { | ||
if (!file.startsWith('test.') || extname(file) !== '.js') | ||
return; | ||
process.stdout.write(`\x1b[90m ${file}\x1b[0m `); | ||
const result = spawnSync(process.argv0, [ join('test', file) ]); | ||
if (result.status === 0) { | ||
process.stdout.write('\x1b[36m✓\x1b[0m\n'); | ||
} else { | ||
process.stdout.write('\x1b[31m✖\x1b[0m\n'); | ||
console.error(result.stderr.toString('utf8')); | ||
process.exit(result.status); | ||
} | ||
}) |