Skip to content

Commit

Permalink
Code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Robdel12 committed Oct 30, 2019
1 parent 63590ee commit 85160e8
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test/utils/logger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ describe('logger utils', () => {

afterEach(() => {
if (filesToCleanUp) {
filesToCleanUp.forEach((file: string) => existsSync(`${process.cwd()}/${file}`) && unlinkSync(`${process.cwd()}/${file}`))
filesToCleanUp.forEach((file: string) => {
let filePath = `${process.cwd()}/${file}`;
if (!existsSync(filePath)) { return; }

unlinkSync(filePath)
})
}
})

it('does not leak memory', async () => {
const output = await captureStdErr(async () => {
await new Promise((resolve) => {
new Array(600).fill(0).forEach((item, index) => {
const fileName = `test-file-${index}`
createFileLogger(fileName)
filesToCleanUp.push(fileName)
})

resolve()
})
const output = await captureStdErr(() => {
for (let index = 0; index < 600; index++) {
const fileName = `test-file-${index}`
createFileLogger(fileName)
filesToCleanUp.push(fileName)
}
})

expect(output).to.equal('')
Expand Down

0 comments on commit 85160e8

Please sign in to comment.