overhaul tests

This commit is contained in:
Rich Harris
2018-10-07 18:23:43 -04:00
committed by GitHub
parent 18acef3190
commit 5e59855a15
183 changed files with 4145 additions and 3126 deletions

23
test/utils.ts Normal file
View File

@@ -0,0 +1,23 @@
import * as fs from 'fs';
import * as path from 'path';
export function wait(ms: number) {
return new Promise(fulfil => setTimeout(fulfil, ms));
}
export function walk(cwd: string, dir = cwd, files: string[] = []) {
fs.readdirSync(dir).forEach(file => {
const resolved = path.resolve(dir, file);
if (fs.statSync(resolved).isDirectory()) {
walk(cwd, resolved, files);
} else {
files.push(posixify(path.relative(cwd, resolved)));
}
});
return files;
}
function posixify(str: string) {
return str.replace(/\\/g, '/');
}