Skip to content

Commit 4eb394c

Browse files
BridgeARmichaelleeallen
authored andcommitted
Fix fs calls without callback (#13)
1 parent 235ba26 commit 4eb394c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/__tests__/index.spec.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,19 @@ describe('reporter file name', () => {
4848

4949
beforeEach(() => {
5050
// remove default and possible test report file if they exist.
51-
fs.unlink(`${cwd}/test-report.xml`);
52-
fs.unlink(`${cwd}/${filename}`);
51+
fs.unlinkSync(`${cwd}/test-report.xml`);
52+
try {
53+
fs.unlinkSync(`${cwd}/${filename}`);
54+
} catch (err) {
55+
if (err.code !== 'ENOENT') {
56+
throw err;
57+
}
58+
}
5359
process.env.TEST_REPORT_FILENAME = filename;
5460
});
5561

5662
afterEach(() => {
57-
fs.unlink(`${cwd}/${filename}`);
63+
fs.unlinkSync(`${cwd}/${filename}`);
5864
delete process.env.TEST_REPORT_FILENAME;
5965
});
6066

0 commit comments

Comments
 (0)