-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2edd92a
commit af900d3
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import assert from "node:assert/strict"; | ||
import { test } from "node:test"; | ||
|
||
test("テストが成功する", async () => { | ||
assert.strictEqual(1, 1); | ||
}); | ||
|
||
const promise = new Promise((resolve) => { | ||
resolve("ok"); | ||
}); | ||
test("await を使ったテストが成功する", async () => { | ||
assert.strictEqual(await promise, "ok"); | ||
}); | ||
|
||
test("テストが失敗する", async () => { | ||
assert.strictEqual(1, 2); | ||
}); | ||
|
||
const promise2 = new Promise((_, reject) => { | ||
reject(new Error("ng")); | ||
}); | ||
test("await を使ったテストが失敗する", async () => { | ||
await promise2; | ||
}); | ||
|
||
test("falty な値を渡すとテストが成功する", (t, done) => { | ||
done(false); | ||
}); | ||
|
||
test("truty な値を渡すとテストが失敗する", (t, done) => { | ||
done(true); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "test-runner", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node --test index.test.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/node": "^22.5.1", | ||
"typescript": "^5.5.4" | ||
} | ||
} |