Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/index-v11.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ Cypress.Commands.overwrite(
},
)

Cypress.Commands.overwrite('task', function (task, args, options) {
Cypress.Commands.overwrite('task', function (originalFn, task, args, options) {
debug('cy.task %o', { args, options })

const cmd = cy.state('current')
Expand All @@ -366,7 +366,7 @@ Cypress.Commands.overwrite('task', function (task, args, options) {

if (next && next.attributes.name === 'if') {
// disable the built-in assertion
return task(args, options).then(
return originalFn(task, args, options).then(
(taskResult) => {
debug('internal task result', taskResult)
return taskResult
Expand All @@ -379,7 +379,7 @@ Cypress.Commands.overwrite('task', function (task, args, options) {
}
}

return task(args, options)
return originalFn(task, args, options)
})

Cypress.Commands.add('raise', (x) => {
Expand All @@ -388,8 +388,8 @@ Cypress.Commands.add('raise', (x) => {
}
const e = new Error(
String(x) +
'\n' +
'cypress-if tip: pass an error instance to have correct stack',
'\n' +
'cypress-if tip: pass an error instance to have correct stack',
)
throw e
})
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ if (major < 12) {
return (subject) => innerFn(subject)
})

Cypress.Commands.overwrite('task', function (task, args, options) {
Cypress.Commands.overwrite('task', function (originalFn, task, args, options) {
debug('cy.task %o', { args, options })

const cmd = cy.state('current')
Expand All @@ -351,7 +351,7 @@ if (major < 12) {

if (isIfCommand(next)) {
// disable the built-in assertion
return task(args, options).then(
return originalFn(task, args, options).then(
(taskResult) => {
debug('internal task result', taskResult)
return taskResult
Expand All @@ -364,7 +364,7 @@ if (major < 12) {
}
}

return task(args, options)
return originalFn(task, args, options);
})

Cypress.Commands.add('raise', (x) => {
Expand All @@ -373,8 +373,8 @@ if (major < 12) {
}
const e = new Error(
String(x) +
'\n' +
'cypress-if tip: pass an error instance to have correct stack',
'\n' +
'cypress-if tip: pass an error instance to have correct stack',
)
throw e
})
Expand Down
Loading