Skip to content

Commit

Permalink
Attempt to fix possible race condition with sinon.spy
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Nov 5, 2018
1 parent 8b9c16f commit 229c69f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/_util.js
Expand Up @@ -31,11 +31,15 @@ test.after.always(t => {
test.beforeEach(t => {
t.context.workDir = tempy.directory()
t.context.tempDir = tempy.directory()
sinon.spy(console, 'warn')
if (!console.warn.restore) {
sinon.spy(console, 'warn')
}
})

test.afterEach.always(t => {
console.warn.restore()
if (console.warn.restore) {
console.warn.restore()
}
return fs.remove(t.context.workDir)
.then(() => fs.remove(t.context.tempDir))
})
Expand Down

0 comments on commit 229c69f

Please sign in to comment.