Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions internal/compiler/projectreferenceparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ func (t *projectReferenceParseTask) parse(projectReferenceParser *projectReferen
if t.resolved == nil {
return
}
if t.resolved.SourceToProjectReference() == nil {
projectReferenceParser.wg.Queue(func() {
t.resolved.ParseInputOutputNames()
})
}
t.resolved.ParseInputOutputNames()
if subReferences := t.resolved.ResolvedProjectReferencePaths(); len(subReferences) > 0 {
t.subTasks = createProjectReferenceParseTasks(subReferences)
}
Expand Down
83 changes: 83 additions & 0 deletions internal/execute/tsctests/tscbuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2068,6 +2068,89 @@ func TestBuildProgramUpdates(t *testing.T) {
}
}

func TestBuildProjectsBuilding(t *testing.T) {
t.Parallel()
addPackageFiles := func(files FileMap, index int) {
files[fmt.Sprintf(`/user/username/projects/myproject/pkg%d/index.ts`, index)] = fmt.Sprintf(`export const pkg%d = %d;`, index, index)
var references string
if index > 0 {
references = `"references": [{ "path": "../pkg0" }],`
}
files[fmt.Sprintf(`/user/username/projects/myproject/pkg%d/tsconfig.json`, index)] = stringtestutil.Dedent(fmt.Sprintf(`
{
"compilerOptions": { "composite": true },
%s
}`, references))
}
addSolution := func(files FileMap, count int) {
var pkgReferences []string
for i := range count {
pkgReferences = append(pkgReferences, fmt.Sprintf(`{ "path": "./pkg%d" }`, i))
}
files[`/user/username/projects/myproject/tsconfig.json`] = stringtestutil.Dedent(fmt.Sprintf(`
{
"compilerOptions": { "composite": true },
"references": [
%s
]
}`, strings.Join(pkgReferences, ",\n\t\t\t\t")))
}
files := func(count int) FileMap {
files := FileMap{}
for i := range count {
addPackageFiles(files, i)
}
addSolution(files, count)
return files
}

getTestCases := func(pkgCount int) []*tscInput {
edits := []*tscEdit{
{
caption: "dts doesn't change",
edit: func(sys *testSys) {
sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `const someConst2 = 10;`)
},
},
noChange,
{
caption: "dts change",
edit: func(sys *testSys) {
sys.appendFile(`/user/username/projects/myproject/pkg0/index.ts`, `export const someConst = 10;`)
},
},
noChange,
}
return []*tscInput{
{
subScenario: fmt.Sprintf(`when there are %d projects in a solution`, pkgCount),
files: files(pkgCount),
cwd: "/user/username/projects/myproject",
commandLineArgs: []string{"-b", "-v"},
edits: edits,
},
{
subScenario: fmt.Sprintf(`when there are %d projects in a solution`, pkgCount),
files: files(pkgCount),
cwd: "/user/username/projects/myproject",
commandLineArgs: []string{"-b", "-w", "-v"},
edits: edits,
},
}
}

testCases := slices.Concat(
getTestCases(3),
getTestCases(5),
getTestCases(8),
getTestCases(23),
)

for _, test := range testCases {
test.run(t, "projectsBuilding")
}
}

func TestBuildProjectReferenceWithRootDirInParent(t *testing.T) {
t.Parallel()
getBuildProjectReferenceWithRootDirInParentFileMap := func(modify func(files FileMap)) FileMap {
Expand Down
Loading
Loading