Skip to content

Commit

Permalink
process.chdir back to the original directory when test finishes
Browse files Browse the repository at this point in the history
  • Loading branch information
iliapolo committed Apr 29, 2020
1 parent 3327089 commit bbff37a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/decdk/test/sanity.test.ts
Expand Up @@ -7,9 +7,16 @@ test('path.resolve is sane', async () => {

const targetDir = path.join(__dirname, 'fixture');

process.chdir(targetDir);
expect(process.cwd()).toEqual(targetDir);
const cwd = process.cwd();

const resolved = path.resolve('.');
expect(resolved).toEqual(targetDir);
try {
process.chdir(targetDir);
expect(process.cwd()).toEqual(targetDir);

const resolved = path.resolve('.');
expect(resolved).toEqual(targetDir);

} finally {
process.chdir(cwd);
}
});

0 comments on commit bbff37a

Please sign in to comment.