Skip to content

Commit

Permalink
chore: [multi-domain] clean up the sync:globals event in the event of…
Browse files Browse the repository at this point in the history
… errors
  • Loading branch information
mjhenkes committed Mar 28, 2022
1 parent 453d1ca commit 68b1dc9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/driver/src/cy/multi-domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export function addCommands (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
return new Bluebird((resolve, reject, onCancel) => {
const cleanup = () => {
communicator.off('queue:finished', onQueueFinished)
communicator.off('sync:globals', onSyncGlobals)
}

onCancel && onCancel(() => {
Expand All @@ -127,10 +128,12 @@ export function addCommands (Commands, Cypress: Cypress.Cypress, cy: Cypress.cy,
_resolve({ subject, unserializableSubjectType })
}

communicator.once('sync:globals', ({ config, env }) => {
const onSyncGlobals = ({ config, env }) => {
syncConfigToCurrentDomain(config)
syncEnvToCurrentDomain(env)
})
}

communicator.once('sync:globals', onSyncGlobals)

communicator.once('ran:domain:fn', (details) => {
const { subject, unserializableSubjectType, err, finished } = details
Expand Down

0 comments on commit 68b1dc9

Please sign in to comment.