Skip to content

Commit

Permalink
test(std/node): avoid project directories for cwd case
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervonb committed Jan 17, 2021
1 parent 2b5b931 commit 53870e5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions std/node/process_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});

Expand Down

0 comments on commit 53870e5

Please sign in to comment.