Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Wrap debug command to ensure mocha timeout not triggered #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ class MochaAdapter {
let result = await new Promise((resolve, reject) => {
this.runner = mocha.run(resolve)

let currentSuite = null
this.runner.on('test', function () { currentSuite = this })

const originalDebug = global.browser.debug
global.browser.debug = function () {
const originalTimeout = currentSuite.test._timeout
currentSuite.test.ctx.timeout(Infinity)
originalDebug.call(global.browser)
currentSuite.test.ctx.timeout(originalTimeout)
}

Object.keys(EVENTS).forEach((e) =>
this.runner.on(e, this.emit.bind(this, EVENTS[e])))

Expand Down