diff options
Diffstat (limited to 'std/node')
-rw-r--r-- | std/node/os.ts | 6 | ||||
-rw-r--r-- | std/node/os_test.ts | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/std/node/os.ts b/std/node/os.ts index f34551da9..4bc70d1ff 100644 --- a/std/node/os.ts +++ b/std/node/os.ts @@ -180,9 +180,9 @@ export function setPriority(pid: number, priority?: number): void { notImplemented(SEE_GITHUB_ISSUE); } -/** Not yet implemented */ -export function tmpdir(): string { - notImplemented(SEE_GITHUB_ISSUE); +/** Returns the operating system's default directory for temporary files as a string. */ +export function tmpdir(): string | null { + return Deno.dir("tmp"); } /** Not yet implemented */ diff --git a/std/node/os_test.ts b/std/node/os_test.ts index 6ef123575..a73a2d4e9 100644 --- a/std/node/os_test.ts +++ b/std/node/os_test.ts @@ -17,6 +17,13 @@ test({ }); test({ + name: "tmp directory is a string", + fn() { + assertEquals(typeof os.tmpdir(), "string"); + } +}); + +test({ name: "hostname is a string", fn() { assertEquals(typeof os.hostname(), "string"); @@ -232,13 +239,6 @@ test({ ); assertThrows( () => { - os.tmpdir(); - }, - Error, - "Not implemented" - ); - assertThrows( - () => { os.totalmem(); }, Error, |