From 5b89e82164f997da863f92c829ff026beabf5abe Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Thu, 10 Sep 2020 02:57:49 +0800 Subject: test(std/examples): make tests runnable from any directory (#7399) --- std/examples/tests/welcome_test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'std/examples/tests/welcome_test.ts') diff --git a/std/examples/tests/welcome_test.ts b/std/examples/tests/welcome_test.ts index d585211a1..5f8d81988 100644 --- a/std/examples/tests/welcome_test.ts +++ b/std/examples/tests/welcome_test.ts @@ -1,11 +1,14 @@ // 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/welcome] print a welcome message", async () => { const decoder = new TextDecoder(); const process = Deno.run({ cmd: [Deno.execPath(), "run", "welcome.ts"], - cwd: "examples", + cwd: moduleDir, stdout: "piped", }); try { -- cgit v1.2.3