diff --git a/src/when.js b/src/when.js index 70c1e30..760b9bb 100644 --- a/src/when.js +++ b/src/when.js @@ -16,6 +16,9 @@ expect.extend({ }) expect().__capture_equals__() let JEST_MATCHERS_OBJECT = Symbol.for('$$jest-matchers-object') +// Hackily reset assertionCalls back to zero incase dev's tests are using expect.assertions() +global[JEST_MATCHERS_OBJECT].state.assertionCalls = 0 +// Hackily delete the custom matcher that we added delete global[JEST_MATCHERS_OBJECT].matchers.__capture_equals__ /** * End hack diff --git a/src/when.test.js b/src/when.test.js index ea52cd2..1aa506a 100644 --- a/src/when.test.js +++ b/src/when.test.js @@ -821,5 +821,9 @@ describe('When', () => { expect(fn(1)).toEqual('a') // fails and will still return 'b' (as before my change) expect(fn(2)).toEqual('b') }) + + it('does not add to the number of assertion calls', () => { + expect.assertions(0) + }) }) })