From c5d50737f05f6b1999d1973ba5bd260473aadcbd Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Tue, 8 Sep 2020 17:43:43 +0800 Subject: test(std/fs): make tests runnable from any directory (#7388) --- std/fs/ensure_dir_test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'std/fs/ensure_dir_test.ts') diff --git a/std/fs/ensure_dir_test.ts b/std/fs/ensure_dir_test.ts index c24e14d1a..29a7913b1 100644 --- a/std/fs/ensure_dir_test.ts +++ b/std/fs/ensure_dir_test.ts @@ -4,7 +4,8 @@ import * as path from "../path/mod.ts"; import { ensureDir, ensureDirSync } from "./ensure_dir.ts"; import { ensureFile, ensureFileSync } from "./ensure_file.ts"; -const testdataDir = path.resolve("fs", "testdata"); +const moduleDir = path.dirname(path.fromFileUrl(import.meta.url)); +const testdataDir = path.resolve(moduleDir, "testdata"); Deno.test("ensureDirIfItNotExist", async function (): Promise { const baseDir = path.join(testdataDir, "ensure_dir_not_exist"); -- cgit v1.2.3