Skip to content

Commit

Permalink
fix test regression in node <10
Browse files Browse the repository at this point in the history
source: fae29d0
Fix #447
  • Loading branch information
isaacs committed May 17, 2018
1 parent 39f73f9 commit 6745ecf
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/mocha.js
Expand Up @@ -60,10 +60,17 @@ mocha.describe('globals', () => {
}))
})

assert.throws(_ => mocha.after(),
new Error('cannot call "after" outside of describe()'))
assert.throws(_ => mocha.before(),
new Error('cannot call "before" outside of describe()'))
if (process.version.match(/v[0-9]\./)) {
assert.throws(_ => mocha.after(),
'cannot call "after" outside of describe()')
assert.throws(_ => mocha.before(),
'cannot call "before" outside of describe()')
} else {
assert.throws(_ => mocha.after(),
new Error('cannot call "after" outside of describe()'))
assert.throws(_ => mocha.before(),
new Error('cannot call "before" outside of describe()'))
}

let calledAfter = false
let calledBefore = false
Expand Down

0 comments on commit 6745ecf

Please sign in to comment.