chore: add test for checking initialized project (#1606)

This is, I think, the natural followup to
https://github.com/denoland/fresh/pull/1539 and
https://github.com/denoland/fresh/pull/1454. Now that we have an easy
way to type check the initialized project, we should assert that there
are no type errors in that project.

This adds three seconds on my slow computer, but I think it's worth it;
releasing code with red squiggles or linting or formatting errors is a
bit silly.
This commit is contained in:
Reed von Redwitz
2023-08-08 22:01:51 +02:00
committed by GitHub
parent 9b4f7a1ad0
commit 81ae7b8427
+16 -1
View File
@@ -27,7 +27,7 @@ const assertFileExistence = async (files: string[], dirname: string) => {
};
Deno.test({
name: "fresh-init",
name: "fresh-init asdf",
async fn(t) {
// Preparation
const tmpDirName = await Deno.makeTempDir();
@@ -64,6 +64,21 @@ Deno.test({
await assertFileExistence(files, tmpDirName);
});
await t.step("check project", async () => {
const cliProcess = new Deno.Command(Deno.execPath(), {
args: [
"task",
"check",
],
cwd: tmpDirName,
stdin: "null",
stdout: "piped",
stderr: "piped",
});
const { code } = await cliProcess.output();
assertEquals(code, 0);
});
await t.step("start up the server and access the root page", async () => {
const { serverProcess, lines, address } = await startFreshServer({
args: ["run", "-A", "--check", "main.ts"],