Skip to content

Commit

Permalink
Merge branch 'develop' into issue-8359-esmoduleinterop
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbreiding authored Aug 24, 2020
2 parents add9883 + 96c8747 commit dc25751
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
11 changes: 7 additions & 4 deletions packages/driver/src/cypress/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -1010,12 +1010,15 @@ const create = (specWindow, mocha, Cypress, cy) => {
}

const maybeHandleRetry = (runnable, err) => {
if (!err) return

const r = runnable
const isHook = r.type === 'hook'
const isTest = r.type === 'test'
const test = getTest() || getTestFromHook(runnable, getTestById)
const isBeforeEachHook = isHook && !!r.hookName.match(/before each/)
const isAfterEachHook = isHook && !!r.hookName.match(/after each/)
const hookName = isHook && getHookName(r)
const isBeforeEachHook = isHook && !!hookName.match(/before each/)
const isAfterEachHook = isHook && !!hookName.match(/after each/)
const retryAbleRunnable = isTest || isBeforeEachHook || isAfterEachHook
const willRetry = (test._currentRetry < test._retries) && retryAbleRunnable

Expand Down Expand Up @@ -1196,8 +1199,8 @@ const create = (specWindow, mocha, Cypress, cy) => {

const isHook = runnable.type === 'hook'

const isAfterEachHook = isHook && runnable.hookName.match(/after each/)
const isBeforeEachHook = isHook && runnable.hookName.match(/before each/)
const isAfterEachHook = isHook && hookName.match(/after each/)
const isBeforeEachHook = isHook && hookName.match(/before each/)

// if we've been told to skip hooks at a certain nested level
// this happens if we're handling a runnable that is going to retry due to failing in a hook
Expand Down
20 changes: 20 additions & 0 deletions packages/runner/cypress/integration/issues/issue-8350.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { createCypress } = require('../../support/helpers')
const { runIsolatedCypress } = createCypress()

// https://github.com/cypress-io/cypress/issues/8350
describe('issue-8350', () => {
it('does not hang on nested hook', () => {
runIsolatedCypress(() => {
before(() => {
beforeEach(() => {
})
})

describe('s1', () => {
it('t1', () => {
//
})
})
})
})
})
5 changes: 0 additions & 5 deletions packages/runner/cypress/support/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,6 @@ function createCypress (defaultOptions = {}) {
if (testsInOwnFile) return

generateMochaTestsForWin(specWindow, mochaTestsOrFile)
specWindow.before = () => {}
specWindow.beforeEach = () => {}
specWindow.afterEach = () => {}
specWindow.after = () => {}
specWindow.describe = () => {}
})

cy.stub(autCypress, 'run').snapshot(enableStubSnapshots).log(false).callsFake(runIsolatedCypress)
Expand Down

0 comments on commit dc25751

Please sign in to comment.