diff --git a/internal/fourslash/baselineutil.go b/internal/fourslash/baselineutil.go index b233a86e68..03eb2210ff 100644 --- a/internal/fourslash/baselineutil.go +++ b/internal/fourslash/baselineutil.go @@ -58,8 +58,13 @@ func getBaselineExtension(command string) string { } } -func getBaselineOptions(command string) baseline.Options { +func getBaselineOptions(command string, testPath string) baseline.Options { subfolder := "fourslash/" + normalizeCommandName(command) + if !isSubmoduleTest(testPath) { + return baseline.Options{ + Subfolder: subfolder, + } + } switch command { case "Smart Selection": return baseline.Options{ @@ -229,6 +234,10 @@ func getBaselineOptions(command string) baseline.Options { } } +func isSubmoduleTest(testPath string) bool { + return strings.Contains(testPath, "fourslash/tests/gen") || strings.Contains(testPath, "fourslash/tests/manual") +} + func normalizeCommandName(command string) string { words := strings.Fields(command) command = strings.Join(words, "") diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 6edbbf1be6..0665e58a24 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "maps" + "runtime" "slices" "strings" "testing" @@ -203,9 +204,10 @@ func NewFourslash(t *testing.T, capabilities *lsproto.ClientCapabilities, conten } f.activeFilename = f.testData.Files[0].fileName + _, testPath, _, _ := runtime.Caller(1) t.Cleanup(func() { inputWriter.Close() - f.verifyBaselines(t) + f.verifyBaselines(t, testPath) }) return f } @@ -2243,9 +2245,9 @@ func (f *FourslashTest) getRangeText(r *RangeMarker) string { return script.content[r.Range.Pos():r.Range.End()] } -func (f *FourslashTest) verifyBaselines(t *testing.T) { +func (f *FourslashTest) verifyBaselines(t *testing.T, testPath string) { for command, content := range f.baselines { - baseline.Run(t, getBaselineFileName(t, command), content.String(), getBaselineOptions(command)) + baseline.Run(t, getBaselineFileName(t, command), content.String(), getBaselineOptions(command, testPath)) } } diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline b/testdata/baselines/reference/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline similarity index 100% rename from testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline rename to testdata/baselines/reference/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline diff --git a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline.diff b/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline.diff deleted file mode 100644 index 4b68d3baf3..0000000000 --- a/testdata/baselines/reference/submodule/fourslash/inlayHints/inlayHintsTupleTypeCrash.baseline.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.inlayHintsTupleTypeCrash.baseline -+++ new.inlayHintsTupleTypeCrash.baseline -@@= skipped --1, +0 lines =@@ -+// === Inlay Hints === -+ tuples.forEach((l) => {}) -+ ^ -+{ -+ "label": [ -+ { -+ "value": ": " -+ }, -+ { -+ "value": "[" -+ }, -+ { -+ "value": "string" -+ }, -+ { -+ "value": "]" -+ } -+ ], -+ "kind": 1, -+ "paddingLeft": true -+} \ No newline at end of file