-
Notifications
You must be signed in to change notification settings - Fork 89
/
sass-spec.ts
56 lines (50 loc) · 1.68 KB
/
sass-spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {fromRoot} from './lib/spec-directory';
import {Interactor} from './lib/interactor';
import {parseArgs, CliArgs} from './lib/cli-args';
import TestCase from './lib/test-case';
import Tabulator from './lib/tabulator';
async function runAllTests() {
let args_: CliArgs | undefined;
try {
const interactor = new Interactor(process.stdin, process.stdout);
const start = Date.now();
const args = (args_ = await parseArgs(process.argv.slice(2)));
const rootPath = args.root;
const rootDir = await fromRoot(rootPath);
const tabulator = new Tabulator(process.stdout, args.verbose);
const dirsToTest =
args.testDirs.length === 0
? undefined
: // Ignore a trailing .hrx because shell completion often adds it and
// it's clear that it means"everything in the archive".
args.testDirs.map(dir => dir.replace(/\.hrx$/, ''));
await rootDir.forEachTest(async testDir => {
const test = await TestCase.create(
testDir,
args.impl,
args.compiler,
args.todoMode,
{
trimErrors: args.trimErrors,
skipWarning: args.skipWarning,
ignoreErrorDiffs: args.ignoreErrorDiffs,
}
);
if (test.result().type === 'fail' && args.interactive) {
await interactor.prompt(test);
}
tabulator.tabulate(test);
}, dirsToTest);
const end = Date.now();
const time = (end - start) / 1000;
tabulator.printResults();
console.log(`Finished in ${time}s`);
process.exitCode = tabulator.exitCode();
} catch (error) {
console.log(`${error}`);
process.exitCode = 255;
} finally {
args_?.compiler?.shutdown();
}
}
runAllTests();