forked from rosa/hakurei
Compare commits
9 Commits
dcf70a458b
...
5944b799ac
| Author | SHA1 | Date | |
|---|---|---|---|
|
5944b799ac
|
|||
|
e22650e526
|
|||
|
4e7b6b7d79
|
|||
|
352e77c5d5
|
|||
|
45547ae6a6
|
|||
|
f113030aec
|
|||
|
7c0c8fff8f
|
|||
|
a209ad5237
|
|||
|
12eacd957d
|
@@ -1,40 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
// Many editors have terminal emulators built in, so running tests with NodeJS
|
// Many editors have terminal emulators built in, so running tests with NodeJS
|
||||||
// provides faster iteration, especially for those acclimated to test-driven
|
// provides faster iteration, especially for those acclimated to test-driven
|
||||||
// development.
|
// development.
|
||||||
|
|
||||||
import "./all_tests.js";
|
import "./all_tests.js";
|
||||||
import { StreamReporter, TESTS } from "./test.js";
|
import { StreamReporter, TESTS } from "./test.js";
|
||||||
|
TESTS.run(new StreamReporter({ writeln: console.log }));
|
||||||
// TypeScript doesn't like process and Deno as their type definitions aren't
|
|
||||||
// installed, but doesn't seem to complain if they're accessed through
|
|
||||||
// globalThis.
|
|
||||||
const process: any = globalThis.process;
|
|
||||||
const Deno: any = globalThis.Deno;
|
|
||||||
|
|
||||||
function getArgs(): string[] {
|
|
||||||
if (process) {
|
|
||||||
const [runtime, program, ...args] = process.argv;
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
if (Deno) return Deno.args;
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
const args = getArgs();
|
|
||||||
let verbose = false;
|
|
||||||
if (args.length > 1) {
|
|
||||||
console.error("Too many arguments");
|
|
||||||
(Deno ? Deno : process).exit(1);
|
|
||||||
}
|
|
||||||
if (args.length === 1) {
|
|
||||||
if (args[0] === "-v" || args[0] === "--verbose" || args[0] === "-verbose") {
|
|
||||||
verbose = true;
|
|
||||||
} else if (args[0] !== "--") {
|
|
||||||
console.error(`Unknown argument '${args[0]}'`);
|
|
||||||
(Deno ? Deno : process).exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TESTS.run(new StreamReporter({ writeln: console.log }, verbose));
|
|
||||||
|
|||||||
Reference in New Issue
Block a user