diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-09-10 02:57:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 20:57:49 +0200 |
commit | 5b89e82164f997da863f92c829ff026beabf5abe (patch) | |
tree | 60461ce91f3f3976115a7535dd2bc6b9fe3a5f81 /std/examples/chat | |
parent | 25053f92ffcefa7659ac8c7b1aa2d80986942c4f (diff) |
test(std/examples): make tests runnable from any directory (#7399)
Diffstat (limited to 'std/examples/chat')
-rw-r--r-- | std/examples/chat/server_test.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts index 27745e659..8a5bf5471 100644 --- a/std/examples/chat/server_test.ts +++ b/std/examples/chat/server_test.ts @@ -4,6 +4,9 @@ import { TextProtoReader } from "../../textproto/mod.ts"; import { BufReader } from "../../io/bufio.ts"; import { connectWebSocket, WebSocket } from "../../ws/mod.ts"; import { delay } from "../../async/delay.ts"; +import { resolve, dirname, fromFileUrl } from "../../path/mod.ts"; + +const moduleDir = resolve(dirname(fromFileUrl(import.meta.url))); async function startServer(): Promise< Deno.Process<Deno.RunOptions & { stdout: "piped" }> @@ -16,7 +19,7 @@ async function startServer(): Promise< "--allow-read", "server.ts", ], - cwd: "examples/chat", + cwd: moduleDir, stdout: "piped", }); try { |