-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: run all tests through vitest runner (#439)
- Loading branch information
Showing
12 changed files
with
114 additions
and
89 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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
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
This file was deleted.
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,32 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { x } from "tinyexec"; | ||
|
||
describe("node coverage", () => { | ||
it("collect and check", async () => { | ||
const { exitCode, stdout, stderr } = await x( | ||
"node", | ||
[ | ||
"--disable-warning=ExperimentalWarning", | ||
"--experimental-strip-types", | ||
"./node-coverage.ts", | ||
"--json", | ||
], | ||
{ | ||
nodeOptions: { | ||
cwd: __dirname, | ||
}, | ||
}, | ||
); | ||
expect(exitCode).toBe(0); | ||
expect(stderr.replaceAll(/\(node:\d+\) /g, "")).toMatchInlineSnapshot(` | ||
"[DEP0040] DeprecationWarning: The \`punycode\` module is deprecated. Please use a userland alternative instead. | ||
(Use \`node --trace-deprecation ...\` to show where the warning was created) | ||
[DEP0025] DeprecationWarning: sys is deprecated. Use util instead. | ||
" | ||
`); | ||
const coverage = JSON.parse(stdout); | ||
for (const mod of coverage) { | ||
expect(mod.unsupportedExports, mod.name).length(0); | ||
} | ||
}); | ||
}); |
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
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,24 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { x } from "tinyexec"; | ||
|
||
describe("tests in node", () => { | ||
it("run", async () => { | ||
const { exitCode, stderr, stdout } = await x( | ||
"node", | ||
[ | ||
"--disable-warning=ExperimentalWarning", | ||
"--experimental-strip-types", | ||
"--test", | ||
"./node/test-*", | ||
], | ||
{ | ||
nodeOptions: { | ||
cwd: __dirname, | ||
}, | ||
}, | ||
); | ||
expect(exitCode).toBe(0); | ||
expect(stderr).toBe(""); | ||
expect(stdout).include("fail 0"); | ||
}); | ||
}); |
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,37 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { x } from "tinyexec"; | ||
|
||
describe("tests in workerd", () => { | ||
it("run", async () => { | ||
const { exitCode, stderr } = await x("node", ["./workerd/main.mjs"], { | ||
nodeOptions: { | ||
cwd: __dirname, | ||
}, | ||
}); | ||
expect(exitCode).toBe(0); | ||
expect(stderr.replaceAll(/\(node:\d+\) /g, "")).toMatchInlineSnapshot(` | ||
"workerd/server/server.c++:4370: debug: [ TEST ] tests:crypto_getRandomValues | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:crypto_getRandomValues | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:unenv_polyfills_buffer | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:unenv_polyfills_buffer | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:unenv_polyfills_path | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:unenv_polyfills_path | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:url_parse | ||
[DeprecationWarning] [unenv] [node:url] DEP0169: \`url.parse()\` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for \`url.parse()\` vulnerabilities. | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:url_parse | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:workerd_dns | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:workerd_dns | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:workerd_implements_buffer | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:workerd_implements_buffer | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:workerd_modules | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:workerd_modules | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:workerd_net | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:workerd_net | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:workerd_path | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:workerd_path | ||
workerd/server/server.c++:4370: debug: [ TEST ] tests:workerd_timers | ||
workerd/server/server.c++:4378: debug: [ PASS ] tests:workerd_timers | ||
" | ||
`); | ||
}); | ||
}); |
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