Skip to content

Commit

Permalink
Merge branch 'develop' into tgriesser/chore/perf-spike
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser authored Jul 28, 2021
2 parents 0113974 + 8550842 commit 3a68ac9
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

0 comments on commit 3a68ac9

Please sign in to comment.