Skip to content

Commit

Permalink
change command:update to command:end
Browse files Browse the repository at this point in the history
  • Loading branch information
AtofStryker committed Jan 14, 2022
1 parent 4429a97 commit aca778c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions packages/driver/src/cy/multi-domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,12 @@ export function addCommands (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
Cypress.action('cy:enqueue:command', attrs)
}

const updateCommand = ({ id, end }) => {
if (end) {
const command = commands[id]
const endCommand = ({ id }) => {
const command = commands[id]

if (command) {
delete commands[id]
command.deferred.resolve()
}
if (command) {
delete commands[id]
command.deferred.resolve()
}
}

Expand Down Expand Up @@ -186,7 +184,7 @@ export function addCommands (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
const pendingCommands = _.map(commands, (command) => command.deferred.promise)

await Promise.all(pendingCommands)
communicator.off('command:update', updateCommand)
communicator.off('command:end', endCommand)
}

const cleanupLogs = async () => {
Expand Down Expand Up @@ -227,7 +225,7 @@ export function addCommands (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
}

communicator.on('command:enqueued', addCommand)
communicator.on('command:update', updateCommand)
communicator.on('command:end', endCommand)

communicator.on('log:added', onLogAdded)
communicator.on('log:changed', onLogChanged)
Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/multi-domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const onCommandEnd = (command: Cypress.CommandQueue) => {
const id = command.get('id')
const name = command.get('name')

specBridgeCommunicator.toPrimary('command:update', { id, name, end: true })
specBridgeCommunicator.toPrimary('command:end', { id, name })
}

const onLogAdded = (attrs) => {
Expand Down

0 comments on commit aca778c

Please sign in to comment.