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/tests/xeval_test.ts | |
parent | 25053f92ffcefa7659ac8c7b1aa2d80986942c4f (diff) |
test(std/examples): make tests runnable from any directory (#7399)
Diffstat (limited to 'std/examples/tests/xeval_test.ts')
-rw-r--r-- | std/examples/tests/xeval_test.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/std/examples/tests/xeval_test.ts b/std/examples/tests/xeval_test.ts index cc74c5226..d3493d397 100644 --- a/std/examples/tests/xeval_test.ts +++ b/std/examples/tests/xeval_test.ts @@ -7,6 +7,9 @@ import { assertStringContains, assert, } from "../../testing/asserts.ts"; +import { resolve, dirname, fromFileUrl } from "../../path/mod.ts"; + +const moduleDir = resolve(dirname(fromFileUrl(import.meta.url)), ".."); Deno.test("xevalSuccess", async function (): Promise<void> { const chunks: string[] = []; @@ -26,7 +29,7 @@ Deno.test("xevalDelimiter", async function (): Promise<void> { assertEquals(chunks, ["!MAD", "ADAM!"]); }); -const xevalPath = "examples/xeval.ts"; +const xevalPath = "xeval.ts"; Deno.test({ name: "xevalCliReplvar", @@ -39,6 +42,7 @@ Deno.test({ "--replvar=abc", "console.log(abc)", ], + cwd: moduleDir, stdin: "piped", stdout: "piped", stderr: "null", @@ -55,6 +59,7 @@ Deno.test({ Deno.test("xevalCliSyntaxError", async function (): Promise<void> { const p = Deno.run({ cmd: [Deno.execPath(), "run", xevalPath, "("], + cwd: moduleDir, stdin: "null", stdout: "piped", stderr: "piped", |