Skip to content

Commit

Permalink
fix: only rerun if current spec+deps changed (#17269)
Browse files Browse the repository at this point in the history
Co-authored-by: Lachlan Miller <[email protected]>
  • Loading branch information
Barthélémy Ledoux and lmiller1990 authored Jul 26, 2021
1 parent b3dd061 commit 1433b64
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion npm/vite-dev-server/src/makeCypressPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const makeCypressPlugin = (
for (const mod of moduleImporters.values()) {
if (specsPathsSet.has(mod.file)) {
debug('handleHotUpdate - compile success')
devServerEvents.emit('dev-server:compile:success')
devServerEvents.emit('dev-server:compile:success', { specFile: mod.file })

return []
}
Expand Down
6 changes: 6 additions & 0 deletions packages/runner-shared/src/event-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ export const eventManager = {
localBus.emit('script:error', error)
})

ws.on('dev-server:compile:success', ({ specFile }) => {
if (!specFile || specFile === state.spec.absolute) {
rerun()
}
})

_.each(socketRerunEvents, (event) => {
ws.on(event, rerun)
})
Expand Down
4 changes: 2 additions & 2 deletions packages/server-ct/src/socket-ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class SocketCt extends SocketBase {

// should we use this option at all for component testing 😕?
if (config.watchForFileChanges) {
devServer.emitter.on('dev-server:compile:success', () => {
this.toRunner('runner:restart')
devServer.emitter.on('dev-server:compile:success', ({ specFile }) => {
this.toRunner('dev-server:compile:success', { specFile })
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/server/lib/plugins/child/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const wrap = (ipc, invoke, ids, [options]) => {
ipc.send('dev-server:compile:error', error)
})

devServerEvents.on('dev-server:compile:success', () => {
ipc.send('dev-server:compile:success')
devServerEvents.on('dev-server:compile:success', ({ specFile } = {}) => {
ipc.send('dev-server:compile:success', { specFile })
})

options.devServerEvents = devServerEvents
Expand Down
4 changes: 2 additions & 2 deletions packages/server/lib/plugins/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ plugins.registerHandler((ipc) => {
baseEmitter.emit('dev-server:compile:error', error)
})

ipc.on('dev-server:compile:success', () => {
baseEmitter.emit('dev-server:compile:success')
ipc.on('dev-server:compile:success', ({ specFile } = {}) => {
baseEmitter.emit('dev-server:compile:success', { specFile })
})

return baseEmitter.on('dev-server:close', () => {
Expand Down

4 comments on commit 1433b64

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1433b64 Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/circle-develop-1433b64d25f186774471593892c1c03aa954c4e3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1433b64 Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/appveyor-develop-1433b64d25f186774471593892c1c03aa954c4e3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1433b64 Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/appveyor-develop-1433b64d25f186774471593892c1c03aa954c4e3/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1433b64 Jul 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/circle-develop-1433b64d25f186774471593892c1c03aa954c4e3/cypress.tgz

Please sign in to comment.