Skip to content

Commit 81e543a

Browse files
authored
refactor: remove GitInfo from run mode (#21659)
* refactor: remove GitInfo from run mode
1 parent a937e4c commit 81e543a

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

packages/data-context/src/data/ProjectLifecycleManager.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,19 @@ export class ProjectLifecycleManager {
418418
this.ctx.update((s) => {
419419
s.currentProject = projectRoot
420420
s.currentProjectGitInfo?.destroy()
421-
s.currentProjectGitInfo = new GitDataSource({
422-
isRunMode: this.ctx.isRunMode,
423-
projectRoot,
424-
onError: this.ctx.onError,
425-
onBranchChange: () => {
426-
this.ctx.emitter.branchChange()
427-
},
428-
onGitInfoChange: (specPaths) => {
429-
this.ctx.emitter.gitInfoChange(specPaths)
430-
},
431-
})
421+
if (!this.ctx.isRunMode) {
422+
s.currentProjectGitInfo = new GitDataSource({
423+
isRunMode: this.ctx.isRunMode,
424+
projectRoot,
425+
onError: this.ctx.onError,
426+
onBranchChange: () => {
427+
this.ctx.emitter.branchChange()
428+
},
429+
onGitInfoChange: (specPaths) => {
430+
this.ctx.emitter.gitInfoChange(specPaths)
431+
},
432+
})
433+
}
432434

433435
s.currentProjectData = { error: null, warnings: [], testingTypeData: null }
434436
s.packageManager = packageManagerUsed

packages/data-context/test/unit/sources/GitDataSource.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('GitDataSource', () => {
6666

6767
const dfd = pDefer()
6868

69-
onGitInfoChange.onFirstCall().callsFake(dfd.resolve)
69+
onGitInfoChange.onSecondCall().callsFake(dfd.resolve)
7070

7171
gitInfo.setSpecs([fooSpec, aRecordSpec, xhrSpec])
7272

0 commit comments

Comments
 (0)