Skip to content

Commit 2773bd6

Browse files
authored
Merge pull request #19 from mrloop/assert-throws
fix: make sure assert.throws uses our assert proxy
2 parents 1273fcb + a938c4e commit 2773bd6

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/retry.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default class Retry {
1212
testFn(...args, async (assert, ...callbackArgs) => {
1313
this.assertProxy = new Proxy(assert, this.assertResultHandler)
1414
this.callbackArgs = callbackArgs
15+
assert.test.assert = this.assertProxy
1516
this.currentRun = 1
1617
await this.retry(this.currentRun)
1718
})

test/retry.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,22 @@ QUnit.module('assert.expect', function () {
246246
})
247247
})
248248

249+
QUnit.module('assert.throws', function () {
250+
const calls = []
251+
252+
retry('count retries', function (assert, currentRun) {
253+
calls.push(currentRun)
254+
255+
assert.throws(() => {
256+
if (currentRun === 2) throw new Error('fail')
257+
})
258+
})
259+
260+
QUnit.test('verify calls', function (assert) {
261+
assert.deepEqual(calls, [1, 2])
262+
})
263+
})
264+
249265
QUnit.module('retry.todo', function () {
250266
const calls = []
251267

0 commit comments

Comments
 (0)