Skip to content

Commit

Permalink
fix: Change cy.end() back to a command instead of a query
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueWinds committed Nov 14, 2022
1 parent 9ae911f commit 280dfee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/driver/cypress/e2e/commands/misc.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ describe('src/cy/commands/misc', () => {
it('nulls out the subject', () => {
cy.noop({}).end().then((subject) => {
expect(subject).to.be.null

// We want cy.end() to break the subject chain - any previous entries
// (in this case `{}`) should be discarded. No re-running any previous
// query functions once you've used `.end()` on a chain.
expect(cy.subjectChain()).to.eql([null])
})
})
})
Expand Down
5 changes: 2 additions & 3 deletions packages/driver/src/cy/commands/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ interface InternalWrapOptions extends Partial<Cypress.Loggable & Cypress.Timeout
}

export default (Commands, Cypress, cy, state) => {
Commands.addQuery('end', () => () => null)
Commands.add('end', () => null)
Commands.add('noop', (arg) => arg)

Commands.addQuery('log', (msg, ...args) => {
Cypress.log({
Expand All @@ -24,8 +25,6 @@ export default (Commands, Cypress, cy, state) => {
return () => null
})

Commands.add('noop', (arg) => arg)

Commands.addAll({
wrap (arg, userOptions: Partial<Cypress.Loggable & Cypress.Timeoutable> = {}) {
const options: InternalWrapOptions = _.defaults({}, userOptions, {
Expand Down

0 comments on commit 280dfee

Please sign in to comment.