-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- simply run tasks - make them work - ensure we await for the server to have stopped - run them locally 240 times to ensure they are not flaky
- Loading branch information
Showing
4 changed files
with
74 additions
and
1 deletion.
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
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,54 @@ | ||
import { assert, assertEquals } from "jsr:@std/assert"; | ||
import { delay } from "jsr:@std/async"; | ||
|
||
Deno.test({ | ||
name: "tasks", | ||
async fn(test) { | ||
await test.step({ | ||
name: "build", | ||
async fn() { | ||
const command = new Deno.Command("deno", { | ||
args: ["task", "build"], | ||
}); | ||
const { code } = await command.output(); | ||
|
||
assertEquals(code, 0); | ||
}, | ||
}); | ||
|
||
await test.step({ | ||
name: "dev", | ||
async fn() { | ||
const command = new Deno.Command("deno", { | ||
args: ["task", "dev"], | ||
stdout: "null", | ||
stderr: "null", | ||
}); | ||
|
||
const process = command.spawn(); | ||
|
||
/** | ||
* Represents a failing promise while we get a real one | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408 | ||
*/ | ||
const pending = new Response(null, { status: 408 }); | ||
|
||
let response = pending; | ||
while (!response.ok) { | ||
response = await fetch("http://localhost:4507/mononykus/") | ||
.catch(() => pending); | ||
await delay(12); | ||
} | ||
|
||
const html = await response.text(); | ||
|
||
assert(html.startsWith("<!DOCTYPE html>")); | ||
assert(html.includes("<title>Mononykus – Deno + Svelte</title>")); | ||
|
||
process.kill(); | ||
|
||
await process.output(); | ||
}, | ||
}); | ||
}, | ||
}); |
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