diff --git a/js/symlink.ts b/js/symlink.ts index 9230e9fa0b6ab..28bf6c859add6 100644 --- a/js/symlink.ts +++ b/js/symlink.ts @@ -3,14 +3,14 @@ import * as msg from "gen/cli/msg_generated"; import * as flatbuffers from "./flatbuffers"; import * as dispatch from "./dispatch"; import * as util from "./util"; +import { platform } from "./build"; function req( oldname: string, newname: string, type?: string ): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] { - // TODO Use type for Windows. - if (type) { + if (platform.os === "win" && type) { return util.notImplemented(); } const builder = flatbuffers.createBuilder(); diff --git a/js/symlink_test.ts b/js/symlink_test.ts index ae9b0c8cc70e7..2ce6669493f04 100644 --- a/js/symlink_test.ts +++ b/js/symlink_test.ts @@ -14,6 +14,7 @@ testPerm({ read: true, write: true }, function symlinkSyncSuccess(): void { errOnWindows = e; } if (errOnWindows) { + assertEquals(Deno.platform.os, "win"); assertEquals(errOnWindows.kind, Deno.ErrorKind.Other); assertEquals(errOnWindows.message, "Not implemented"); } else { @@ -36,6 +37,7 @@ test(function symlinkSyncPerm(): void { }); // Just for now, until we implement symlink for Windows. +// Symlink with type should succeed on other platforms with type ignored testPerm({ write: true }, function symlinkSyncNotImplemented(): void { let err; try { @@ -43,7 +45,10 @@ testPerm({ write: true }, function symlinkSyncNotImplemented(): void { } catch (e) { err = e; } - assertEquals(err.message, "Not implemented"); + if (err) { + assertEquals(Deno.platform.os, "win"); + assertEquals(err.message, "Not implemented"); + } }); testPerm({ read: true, write: true }, async function symlinkSuccess(): Promise<