Skip to content

Commit

Permalink
fix: do not start spec watcher in run mode (#17494)
Browse files Browse the repository at this point in the history
* fix: do not start spec watcher in run mode

* add tests

* revert change
  • Loading branch information
lmiller1990 authored Jul 28, 2021
1 parent 257ff95 commit 8550842
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/server/lib/project-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,20 +276,25 @@ export class ProjectBase<TServer extends ServerE2E | ServerCt> extends EE {
this.saveState(stateToSave),
])

// start watching specs
// whenever a spec file is added or removed, we notify the
// <SpecList>
// This is only used for CT right now, but it will be
// used for E2E eventually. Until then, do not watch
// the specs.
startSpecWatcher()

await Promise.all([
checkSupportFile({ configFile: cfg.configFile, supportFile: cfg.supportFile }),
this.watchPluginsFile(cfg, this.options),
])

if (cfg.isTextTerminal || !cfg.experimentalInteractiveRunEvents) return
if (cfg.isTextTerminal) {
return
}

// start watching specs
// whenever a spec file is added or removed, we notify the
// <SpecList>
// This is only used for CT right now by general users.
// It is is used with E2E if the CypressInternal_UseInlineSpecList flag is true.
startSpecWatcher()

if (!cfg.experimentalInteractiveRunEvents) {
return
}

const sys = await system.info()
const beforeRunDetails = {
Expand Down
30 changes: 30 additions & 0 deletions packages/server/test/unit/project_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,36 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
})
})

it('does not call startSpecWatcher if not in interactive mode', function () {
const startSpecWatcherStub = sinon.stub()

sinon.stub(ProjectBase.prototype, 'initializeSpecStore').resolves({
startSpecWatcher: startSpecWatcherStub,
})

this.config.isTextTerminal = true

return this.project.open()
.then(() => {
expect(startSpecWatcherStub).not.to.be.called
})
})

it('calls startSpecWatcher if in interactive mode', function () {
const startSpecWatcherStub = sinon.stub()

sinon.stub(ProjectBase.prototype, 'initializeSpecStore').resolves({
startSpecWatcher: startSpecWatcherStub,
})

this.config.isTextTerminal = false

return this.project.open()
.then(() => {
expect(startSpecWatcherStub).to.be.called
})
})

it('does not get system info or execute before:run if experimental flag is not enabled', function () {
sinon.stub(system, 'info')
this.config.experimentalInteractiveRunEvents = false
Expand Down

4 comments on commit 8550842

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8550842 Jul 28, 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-8550842e3696095c9391e89f30c87af6369ecfb9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8550842 Jul 28, 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-8550842e3696095c9391e89f30c87af6369ecfb9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8550842 Jul 28, 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-8550842e3696095c9391e89f30c87af6369ecfb9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8550842 Jul 28, 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-8550842e3696095c9391e89f30c87af6369ecfb9/cypress.tgz

Please sign in to comment.