test(std/fs): make tests runnable from any directory (#7388)

This commit is contained in:
Casper Beyer 2020-09-08 17:43:43 +08:00 committed by GitHub
parent 334ed0e2f4
commit c5d50737f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 9 deletions

View file

@ -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<void> {
const baseDir = path.join(testdataDir, "ensure_dir_not_exist");