Skip to content

Commit

Permalink
Add graceful handle of faulty test files
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebremer committed Dec 9, 2022
1 parent d3c18ab commit 9363092
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
33 changes: 31 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"name": "@typescriptlibs/tst",
"type": "module",
"version": "0.0.3",
"version": "0.0.4",
"bin": "bin/tst.mjs",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -17,6 +17,7 @@
"@types/node": "^10.17.60",
"@types/yargs": "^17.0.14",
"@typescriptlibs/tst": "file:./",
"husky": "^8.0.2",
"typescript": "^4.9.3"
},
"engines": {
Expand All @@ -41,7 +42,7 @@
"build": "tsc -p src/",
"clean": "rm -rf lib tst-run",
"release": "npm publish --access public",
"test": "tst --verbose tst/",
"test": "tst --reset --verbose tst/",
"watch": "tsc -b src/ -w"
}
}
12 changes: 9 additions & 3 deletions src/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ export class CLI {
files = System.filesFrom(target, /\.js$/);
}

const tester = Tester.default;
const errors = tester.errors;

// @todo parallel mode to test atomic
for (const file of files) {
await import(System.joinPath(System.CWD, target, file));
try {
await import(System.joinPath(System.CWD, target, file));
}
catch (error) {
errors.push([file, error]);
}
}

const tester = Tester.default;

await tester.start();

if (argv.includes('--verbose')) {
Expand Down

0 comments on commit 9363092

Please sign in to comment.