mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
test(std/node): avoid project directories for cwd case (#9148)
This commit is contained in:
parent
18150b3a78
commit
12577f2d9a
1 changed files with 8 additions and 9 deletions
|
@ -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);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue