Skip to content

Commit a88da66

Browse files
authored
internal: create studio lifecycle manager when simulating open mode (#32705)
1 parent 4d904e2 commit a88da66

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/server/lib/project-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class ProjectBase extends EE {
180180
})
181181
}
182182

183-
if (!cfg.isTextTerminal && this.testingType === 'e2e') {
183+
if ((!cfg.isTextTerminal || process.env.CYPRESS_INTERNAL_SIMULATE_OPEN_MODE) && this.testingType === 'e2e') {
184184
const studioLifecycleManager = new StudioLifecycleManager()
185185

186186
studioLifecycleManager.initializeStudioManager({

packages/server/test/unit/project_spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ let ctx
2727
describe('lib/project-base', () => {
2828
beforeEach(async function () {
2929
delete process.env.CYPRESS_LOCAL_STUDIO_PATH
30+
delete process.env.CYPRESS_INTERNAL_SIMULATE_OPEN_MODE
3031

3132
ctx = getCtx()
3233
Fixtures.scaffold()
@@ -646,6 +647,21 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
646647

647648
expect(this.project.ctx.coreData.studioLifecycleManager).to.not.be.undefined
648649
})
650+
651+
it('creates studio lifecycle manager when CYPRESS_INTERNAL_SIMULATE_OPEN_MODE is set even in text terminal mode', async function () {
652+
this.project.cfg.isTextTerminal = true
653+
process.env.CYPRESS_INTERNAL_SIMULATE_OPEN_MODE = '1'
654+
655+
sinon.stub(this.project, 'saveState').resolves()
656+
sinon.stub(process, 'chdir')
657+
658+
await this.project.open()
659+
660+
expect(this.project.ctx.coreData.studioLifecycleManager).to.not.be.undefined
661+
662+
// Clean up environment variable
663+
delete process.env.CYPRESS_INTERNAL_SIMULATE_OPEN_MODE
664+
})
649665
})
650666
})
651667

0 commit comments

Comments
 (0)