Skip to content

Commit 53ee499

Browse files
authored
Move tests around to shorter paths (#588)
1 parent 9a2e7ee commit 53ee499

File tree

7 files changed

+61
-50
lines changed

7 files changed

+61
-50
lines changed

.vscode/launch.template.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
],
1818
"autoAttachChildProcesses": true,
1919
"preLaunchTask": "Watch for extension run"
20+
},
21+
{
22+
"name": "Launch submodule test",
23+
"type": "go",
24+
"request": "launch",
25+
"mode": "test",
26+
"program": "${workspaceFolder}/internal/testrunner",
27+
"args": [
28+
"-test.run",
29+
"TestSubmodule/${fileBasename}"
30+
]
2031
}
2132
]
2233
}
File renamed without changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package runner
2+
3+
import (
4+
"testing"
5+
6+
"github.com/microsoft/typescript-go/internal/bundled"
7+
"github.com/microsoft/typescript-go/internal/core"
8+
"github.com/microsoft/typescript-go/internal/repo"
9+
"github.com/microsoft/typescript-go/internal/tspath"
10+
"gotest.tools/v3/assert"
11+
)
12+
13+
// Runs the new compiler tests and produces baselines (e.g. `test1.symbols`).
14+
func TestLocal(t *testing.T) { runCompilerTests(t, false) } //nolint:paralleltest
15+
16+
// Runs the old compiler tests, and produces new baselines (e.g. `test1.symbols`)
17+
// and a diff between the new and old baselines (e.g. `test1.symbols.diff`).
18+
func TestSubmodule(t *testing.T) { runCompilerTests(t, true) } //nolint:paralleltest
19+
20+
func runCompilerTests(t *testing.T, isSubmodule bool) {
21+
t.Parallel()
22+
23+
if isSubmodule {
24+
repo.SkipIfNoTypeScriptSubmodule(t)
25+
}
26+
27+
if !bundled.Embedded {
28+
// Without embedding, we'd need to read all of the lib files out from disk into the MapFS.
29+
// Just skip this for now.
30+
t.Skip("bundled files are not embedded")
31+
}
32+
33+
runners := []*CompilerBaselineRunner{
34+
NewCompilerBaselineRunner(TestTypeRegression, isSubmodule),
35+
NewCompilerBaselineRunner(TestTypeConformance, isSubmodule),
36+
}
37+
38+
var seenTests core.Set[string]
39+
for _, runner := range runners {
40+
for _, test := range runner.EnumerateTestFiles() {
41+
test = tspath.GetBaseFileName(test)
42+
assert.Assert(t, !seenTests.Has(test), "Duplicate test file: %s", test)
43+
seenTests.Add(test)
44+
}
45+
}
46+
47+
for _, runner := range runners {
48+
runner.RunTests(t)
49+
}
50+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/testutil/runner/compiler_runner_test.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)