Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
fix: always reset full context when retrying
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 27, 2018
1 parent 15119b4 commit 72c3588
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ const context: Types.Context = {

const base = <I extends Types.Context>(context: I): Types.Base<I, {}> => {
const end = (arg1: any, cb: Types.MochaCallback<I>) => {
context = assignWithProps({}, context)
const originalContext = context
if (_.isFunction(arg1)) {
cb = arg1
arg1 = undefined
}
if (!arg1) arg1 = context.expectation || 'test'
async function run(this: mocha.ITestCallbackContext, done?: Types.MochaDone) {
// reset error if retrying
delete context.error
context = assignWithProps({}, originalContext)
if (context.retries) this.retries(context.retries)
if (cb) {
context.chain = [...context.chain, {
Expand Down

0 comments on commit 72c3588

Please sign in to comment.