Skip to content

Commit

Permalink
fix: improve test robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
shetzel committed Jun 6, 2023
1 parent c8d03d4 commit 1b29bd3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/unit/util/zipWriterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ describe('ZipWriter', () => {
it('should generate a valid zip file', async () => {
const buf = Buffer.from('hi');
const rootDestination = path.join(os.tmpdir(), 'zipWriterTest');
if (fs.existsSync(rootDestination)) {
fs.rmSync(rootDestination, { recursive: true, force: true });
}
const zipFilePath = path.join(rootDestination, 'myZip.zip');
try {
fs.mkdirSync(rootDestination, { recursive: true });
Expand All @@ -73,8 +76,7 @@ describe('ZipWriter', () => {
expect(fs.existsSync(zipFilePath)).to.be.true;
expect(fs.statSync(zipFilePath).size).to.be.greaterThan(0);
} finally {
fs.unlinkSync(zipFilePath);
fs.rmdirSync(rootDestination);
fs.rmSync(rootDestination, { recursive: true, force: true });
}
});
});

0 comments on commit 1b29bd3

Please sign in to comment.