diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-01-18 20:39:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-18 07:39:35 -0500 |
commit | 12577f2d9a08256417af2f1e92ed7f667f7a4a6a (patch) | |
tree | c82f9bc8c1a2221066a1e5630a4c6150cd767f74 /std/node/process_test.ts | |
parent | 18150b3a78cd02c7c68d4dfced036fd812a17536 (diff) |
test(std/node): avoid project directories for cwd case (#9148)
Diffstat (limited to 'std/node/process_test.ts')
-rw-r--r-- | std/node/process_test.ts | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/std/node/process_test.ts b/std/node/process_test.ts index 40f809edf..2a789a5d7 100644 --- a/std/node/process_test.ts +++ b/std/node/process_test.ts @@ -38,17 +38,16 @@ Deno.test({ fn() { assertEquals(process.cwd(), Deno.cwd()); - const currentDir = Deno.cwd(); // to unchange current directory after this test + const currentDir = Deno.cwd(); - const moduleDir = path.dirname(path.fromFileUrl(import.meta.url)); - process.chdir(path.resolve(moduleDir, "..")); + const tempDir = Deno.makeTempDirSync(); + process.chdir(tempDir); + assertEquals( + Deno.realPathSync(process.cwd()), + Deno.realPathSync(tempDir), + ); - assert(process.cwd().match(/\Wstd$/)); - process.chdir("node"); - assert(process.cwd().match(/\Wnode$/)); - process.chdir(".."); - assert(process.cwd().match(/\Wstd$/)); - process.chdir(currentDir); // to unchange current directory after this test + process.chdir(currentDir); }, }); |