summaryrefslogtreecommitdiff
path: root/std/examples/tests/catj_test.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-09-10 02:57:49 +0800
committerGitHub <noreply@github.com>2020-09-09 20:57:49 +0200
commit5b89e82164f997da863f92c829ff026beabf5abe (patch)
tree60461ce91f3f3976115a7535dd2bc6b9fe3a5f81 /std/examples/tests/catj_test.ts
parent25053f92ffcefa7659ac8c7b1aa2d80986942c4f (diff)
test(std/examples): make tests runnable from any directory (#7399)
Diffstat (limited to 'std/examples/tests/catj_test.ts')
-rw-r--r--std/examples/tests/catj_test.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/std/examples/tests/catj_test.ts b/std/examples/tests/catj_test.ts
index 99320fd1d..c79403421 100644
--- a/std/examples/tests/catj_test.ts
+++ b/std/examples/tests/catj_test.ts
@@ -1,5 +1,8 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { assertStrictEquals } from "../../testing/asserts.ts";
+import { resolve, dirname, fromFileUrl } from "../../path/mod.ts";
+
+const moduleDir = resolve(dirname(fromFileUrl(import.meta.url)), "..");
Deno.test("[examples/catj] print an array", async () => {
const decoder = new TextDecoder();
@@ -80,7 +83,7 @@ function catj(
): Deno.Process<Deno.RunOptions & { stdin: "piped"; stdout: "piped" }> {
return Deno.run({
cmd: [Deno.execPath(), "run", "--allow-read", "catj.ts", ...files],
- cwd: "examples",
+ cwd: moduleDir,
stdin: "piped",
stdout: "piped",
env: { NO_COLOR: "true" },