Skip to content

Commit e3f98c7

Browse files
committed
only initialize studio lifecycle manager when testing type is e2e
1 parent 0118d55 commit e3f98c7

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

packages/server/lib/project-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class ProjectBase extends EE {
158158

159159
this._server = new ServerBase(cfg)
160160

161-
if (!cfg.isTextTerminal) {
161+
if (!cfg.isTextTerminal && this.testingType === 'e2e') {
162162
const studioLifecycleManager = new StudioLifecycleManager()
163163

164164
studioLifecycleManager.initializeStudioManager({

packages/server/test/unit/project_spec.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,19 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
575575

576576
describe('studio initialization', function () {
577577
it('does not create studio lifecycle manager when in text terminal mode', async function () {
578-
const cfg = {
579-
isTextTerminal: true,
580-
projectId: 'test-project',
581-
port: 8080,
582-
}
578+
this.project.cfg.isTextTerminal = true
579+
sinon.stub(this.project, 'saveState').resolves()
580+
581+
sinon.stub(process, 'chdir')
582+
583+
await this.project.open()
584+
585+
expect(this.project.ctx.coreData.studioLifecycleManager).to.be.undefined
586+
})
587+
588+
it('does not create studio lifecycle manager for component testing', async function () {
589+
this.project.testingType = 'component'
583590

584-
sinon.stub(this.project, 'initializeConfig').resolves(cfg)
585591
sinon.stub(this.project, 'saveState').resolves()
586592

587593
sinon.stub(process, 'chdir')
@@ -590,6 +596,16 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
590596

591597
expect(this.project.ctx.coreData.studioLifecycleManager).to.be.undefined
592598
})
599+
600+
it('creates studio lifecycle manager for e2e testing', async function () {
601+
sinon.stub(this.project, 'saveState').resolves()
602+
603+
sinon.stub(process, 'chdir')
604+
605+
await this.project.open()
606+
607+
expect(this.project.ctx.coreData.studioLifecycleManager).to.not.be.undefined
608+
})
593609
})
594610
})
595611

0 commit comments

Comments
 (0)