Skip to content

Commit

Permalink
test(node): avoid project directories for cwd case (denoland/deno#9148)
Browse files Browse the repository at this point in the history
  • Loading branch information
caspervonb authored and denobot committed Feb 1, 2021
1 parent 84ee144 commit 262ae2f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions 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 262ae2f

Please sign in to comment.