Skip to content

Commit

Permalink
chore(test): Added timeout to teardown() to wait for file system beca…
Browse files Browse the repository at this point in the history
…use tests are failing
  • Loading branch information
lamweili committed Jan 19, 2022
1 parent 43a2199 commit bc5286d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions test/tap/multi-file-appender-test.js
Expand Up @@ -236,8 +236,14 @@ test("multiFile appender", batch => {
});
});

batch.tearDown(() => {
fs.rmdirSync("logs");
batch.tearDown(async () => {
try {
const files = fs.readdirSync("logs");
await removeFiles(files.map(filename => `logs/${filename}`));
fs.rmdirSync("logs");
} catch (e) {
// doesn't matter
}
});

batch.end();
Expand Down
11 changes: 8 additions & 3 deletions test/tap/pause-test.js
Expand Up @@ -77,11 +77,16 @@ tap.test("Drain event test", batch => {
logger.info("This is a test for emitting drain event in date file logger");
}
t.end();

});

batch.tearDown(() => {
fs.rmdirSync("logs");
batch.tearDown(async () => {
try {
const files = fs.readdirSync("logs");
await removeFiles(files.map(filename => `logs/${filename}`));
fs.rmdirSync("logs");
} catch (e) {
// doesn't matter
}
});

batch.end();
Expand Down

0 comments on commit bc5286d

Please sign in to comment.