diff options
author | River <22485304+actual-size@users.noreply.github.com> | 2020-06-12 02:36:20 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 12:36:20 -0400 |
commit | 818a8010928cb8cef0b7043bd881c8cdce9b6efc (patch) | |
tree | 1502e74c9eb01901df8da118257d60d4f962b0e4 /cli/tests/unit/test_util.ts | |
parent | 813210d4337bf6e174f1da1f1a6c6fb9b073afa2 (diff) |
feat: URL support in Deno filesystem methods (#5990)
Diffstat (limited to 'cli/tests/unit/test_util.ts')
-rw-r--r-- | cli/tests/unit/test_util.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cli/tests/unit/test_util.ts b/cli/tests/unit/test_util.ts index 8b690505a..660e13511 100644 --- a/cli/tests/unit/test_util.ts +++ b/cli/tests/unit/test_util.ts @@ -1,6 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { assert, assertEquals } from "../../../std/testing/asserts.ts"; +import { resolve } from "../../../std/path/mod.ts"; export { assert, assertThrows, @@ -363,3 +364,9 @@ unitTest( }); } ); + +export function pathToAbsoluteFileUrl(path: string): URL { + path = resolve(path); + + return new URL(`file://${Deno.build.os === "windows" ? "/" : ""}${path}`); +} |