Skip to content

Commit

Permalink
Fix invoking wrong function, add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueWinds committed Jun 28, 2022
1 parent a3a9e35 commit d3aef86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/driver/src/cy/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const command = function (ctx, name, ...args) {
}

export default function (Commands, Cypress, cy) {
$Chainer.add('command', function command (chainer, userInvocationStack, args) {
$Chainer.add('command', function (chainer, userInvocationStack, args) {
// `...args` below is the shorthand of `args[0], ...args.slice(1)`
// TypeScript doesn't allow this.
// @ts-ignore
Expand Down
9 changes: 8 additions & 1 deletion packages/driver/src/cypress/chainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ export class $Chainer {

constructor (specWindow) {
this.specWindow = specWindow
// the id prefix needs to be unique per origin, so there are not
// The id prefix needs to be unique per origin, so there are not
// collisions when chainers created in a secondary origin are passed
// to the primary origin for the command log, etc.
this.chainerId = _.uniqueId(`ch-${window.location.origin}-`)

// firstCall is used to throw a useful error if the user leads off with a
// parent command.

// TODO: Refactor firstCall out of the chainer and into the command function,
// since cy.ts already has all the necessary information to throw this error
// without an instance variable, in one localized place in the code.
this.firstCall = true
}

Expand Down

0 comments on commit d3aef86

Please sign in to comment.