-
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.
Update to latest official deno_cache rather than a patched version
Update tests to use Deno.serve and latest std lib
- Loading branch information
Showing
7 changed files
with
30 additions
and
33 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
.vscode | ||
deno.lock |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"tasks": { | ||
"test": "deno test --allow-read --allow-write --allow-net --allow-env --import-map=test/import_map.json" | ||
"test": "deno test --allow-read --allow-write --allow-net --allow-env --import-map=test/import_map.json", | ||
"check": "deno fmt && deno lint && deno check **/*.ts" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { DenoDir } from "https://raw.githubusercontent.com/jollytoad/deno_cache/fixes/deno_dir.ts"; | ||
export { FileFetcher } from "https://raw.githubusercontent.com/jollytoad/deno_cache/fixes/file_fetcher.ts"; | ||
export { DenoDir } from "https://deno.land/x/deno_cache@0.6.1/deno_dir.ts"; | ||
export { FileFetcher } from "https://deno.land/x/deno_cache@0.6.1/file_fetcher.ts"; |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
export { | ||
assertEquals, | ||
assertRejects, | ||
assertStringIncludes, | ||
} from "https://deno.land/[email protected]/testing/asserts.ts"; | ||
export { generate as randomString } from "https://deno.land/[email protected]/uuid/v1.ts"; | ||
export { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
export { assertRejects } from "https://deno.land/[email protected]/assert/assert_rejects.ts"; | ||
export { assertStringIncludes } from "https://deno.land/[email protected]/assert/assert_string_includes.ts"; | ||
|
||
export { ulid as randomString } from "https://deno.land/[email protected]/ulid/mod.ts"; |
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 |
---|---|---|
@@ -1,9 +1,3 @@ | ||
import { | ||
type Handler, | ||
serve, | ||
type ServeInit, | ||
} from "https://deno.land/[email protected]/http/mod.ts"; | ||
|
||
/** | ||
* Create a basic HTTP server to run a test against. | ||
* | ||
|
@@ -13,16 +7,17 @@ import { | |
* @returns a test function that can be passed directly to `Deno.test` | ||
*/ | ||
export const withServer = ( | ||
handler: Handler, | ||
opts: Pick<ServeInit, "hostname" | "port">, | ||
handler: Deno.ServeHandler, | ||
opts: Pick<Deno.ServeOptions, "hostname" | "port">, | ||
test: (url: string, t: Deno.TestContext) => void | Promise<void>, | ||
) => | ||
async (t: Deno.TestContext) => { | ||
const controller = new AbortController(); | ||
|
||
let caught: unknown; | ||
|
||
await serve(handler, { | ||
await Deno.serve({ | ||
handler, | ||
...opts, | ||
signal: controller.signal, | ||
onListen: ({ hostname, port }) => { | ||
|
@@ -36,7 +31,7 @@ async (t: Deno.TestContext) => { | |
} | ||
}); | ||
}, | ||
}); | ||
}).finished; | ||
|
||
if (caught) { | ||
throw caught; | ||
|