Skip to content

Commit d3aef86

Browse files
committed
Fix invoking wrong function, add comment
1 parent a3a9e35 commit d3aef86

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/driver/src/cy/commands/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const command = function (ctx, name, ...args) {
1616
}
1717

1818
export default function (Commands, Cypress, cy) {
19-
$Chainer.add('command', function command (chainer, userInvocationStack, args) {
19+
$Chainer.add('command', function (chainer, userInvocationStack, args) {
2020
// `...args` below is the shorthand of `args[0], ...args.slice(1)`
2121
// TypeScript doesn't allow this.
2222
// @ts-ignore

packages/driver/src/cypress/chainer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ export class $Chainer {
88

99
constructor (specWindow) {
1010
this.specWindow = specWindow
11-
// the id prefix needs to be unique per origin, so there are not
11+
// The id prefix needs to be unique per origin, so there are not
1212
// collisions when chainers created in a secondary origin are passed
1313
// to the primary origin for the command log, etc.
1414
this.chainerId = _.uniqueId(`ch-${window.location.origin}-`)
15+
16+
// firstCall is used to throw a useful error if the user leads off with a
17+
// parent command.
18+
19+
// TODO: Refactor firstCall out of the chainer and into the command function,
20+
// since cy.ts already has all the necessary information to throw this error
21+
// without an instance variable, in one localized place in the code.
1522
this.firstCall = true
1623
}
1724

0 commit comments

Comments
 (0)