Skip to content

Commit fd94be3

Browse files
authored
Remove concept of "unsupported extensions", clean up test skips (#2004)
1 parent 13d3e19 commit fd94be3

File tree

807 files changed

+2
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

807 files changed

+2
-48
lines changed

internal/compiler/fileloader.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ type processedFiles struct {
6464
importHelpersImportSpecifiers map[tspath.Path]*ast.Node
6565
libFiles map[tspath.Path]*LibFile
6666
// List of present unsupported extensions
67-
unsupportedExtensions []string
6867
sourceFilesFoundSearchingNodeModules collections.Set[tspath.Path]
6968
includeProcessor *includeProcessor
7069
// if file was included using source file and its output is actually part of program
@@ -152,7 +151,6 @@ func processAllProgramFiles(
152151
sourceFileMetaDatas := make(map[tspath.Path]ast.SourceFileMetaData, totalFileCount)
153152
var jsxRuntimeImportSpecifiers map[tspath.Path]*jsxRuntimeImportSpecifier
154153
var importHelpersImportSpecifiers map[tspath.Path]*ast.Node
155-
var unsupportedExtensions []string
156154
var sourceFilesFoundSearchingNodeModules collections.Set[tspath.Path]
157155
libFilesMap := make(map[tspath.Path]*LibFile, libFileCount)
158156

@@ -217,10 +215,6 @@ func processAllProgramFiles(
217215
}
218216
importHelpersImportSpecifiers[path] = task.importHelpersImportSpecifier
219217
}
220-
extension := tspath.TryGetExtensionFromPath(file.FileName())
221-
if slices.Contains(tspath.SupportedJSExtensionsFlat, extension) {
222-
unsupportedExtensions = core.AppendIfUnique(unsupportedExtensions, extension)
223-
}
224218
if task.fromExternalLibrary {
225219
sourceFilesFoundSearchingNodeModules.Add(path)
226220
}
@@ -251,7 +245,6 @@ func processAllProgramFiles(
251245
sourceFileMetaDatas: sourceFileMetaDatas,
252246
jsxRuntimeImportSpecifiers: jsxRuntimeImportSpecifiers,
253247
importHelpersImportSpecifiers: importHelpersImportSpecifiers,
254-
unsupportedExtensions: unsupportedExtensions,
255248
sourceFilesFoundSearchingNodeModules: sourceFilesFoundSearchingNodeModules,
256249
libFiles: libFilesMap,
257250
missingFiles: missingFiles,

internal/compiler/program.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,12 +1605,6 @@ func (p *Program) IsSourceFileFromExternalLibrary(file *ast.SourceFile) bool {
16051605
return p.sourceFilesFoundSearchingNodeModules.Has(file.Path())
16061606
}
16071607

1608-
// UnsupportedExtensions returns a list of all present "unsupported" extensions,
1609-
// e.g. extensions that are not yet supported by the port.
1610-
func (p *Program) UnsupportedExtensions() []string {
1611-
return p.unsupportedExtensions
1612-
}
1613-
16141608
func (p *Program) GetJSXRuntimeImportSpecifier(path tspath.Path) (moduleReference string, specifier *ast.Node) {
16151609
if result := p.jsxRuntimeImportSpecifiers[path]; result != nil {
16161610
return result.moduleReference, result.specifier

internal/testrunner/compiler_runner.go

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ func (r *CompilerBaselineRunner) runSingleConfigTest(t *testing.T, testName stri
209209
compilerTest.verifySourceMapRecord(t, r.testSuitName, r.isSubmodule)
210210
compilerTest.verifyTypesAndSymbols(t, r.testSuitName, r.isSubmodule)
211211
compilerTest.verifyModuleResolution(t, r.testSuitName, r.isSubmodule)
212-
// !!! Verify all baselines
213-
214212
compilerTest.verifyUnionOrdering(t)
215213
compilerTest.verifyParentPointers(t)
216214
}
@@ -368,9 +366,8 @@ func (c *compilerTest) verifyDiagnostics(t *testing.T, suiteName string, isSubmo
368366
defer testutil.RecoverAndFail(t, "Panic on creating error baseline for test "+c.filename)
369367
files := core.Concatenate(c.tsConfigFiles, core.Concatenate(c.toBeCompiled, c.otherFiles))
370368
tsbaseline.DoErrorBaseline(t, c.configuredName, files, c.result.Diagnostics, c.result.Options.Pretty.IsTrue(), baseline.Options{
371-
Subfolder: suiteName,
372-
IsSubmodule: isSubmodule,
373-
IsSubmoduleAccepted: c.containsUnsupportedOptionsForDiagnostics(),
369+
Subfolder: suiteName,
370+
IsSubmodule: isSubmodule,
374371
DiffFixupOld: func(old string) string {
375372
var sb strings.Builder
376373
sb.Grow(len(old))
@@ -410,11 +407,6 @@ func (c *compilerTest) verifyJavaScriptOutput(t *testing.T, suiteName string, is
410407
return
411408
}
412409

413-
if c.options.OutFile != "" {
414-
// Just return, no t.Skip; this is unsupported so testing them is not helpful.
415-
return
416-
}
417-
418410
t.Run("output", func(t *testing.T) {
419411
if msg, ok := skippedEmitTests[c.basename]; ok {
420412
t.Skip(msg)
@@ -442,11 +434,6 @@ func (c *compilerTest) verifyJavaScriptOutput(t *testing.T, suiteName string, is
442434
}
443435

444436
func (c *compilerTest) verifySourceMapOutput(t *testing.T, suiteName string, isSubmodule bool) {
445-
if c.options.OutFile != "" {
446-
// Just return, no t.Skip; this is unsupported so testing them is not helpful.
447-
return
448-
}
449-
450437
t.Run("sourcemap", func(t *testing.T) {
451438
defer testutil.RecoverAndFail(t, "Panic on creating source map output for test "+c.filename)
452439
headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath, c.filename, tspath.ComparePathsOptions{})
@@ -467,11 +454,6 @@ func (c *compilerTest) verifySourceMapOutput(t *testing.T, suiteName string, isS
467454
}
468455

469456
func (c *compilerTest) verifySourceMapRecord(t *testing.T, suiteName string, isSubmodule bool) {
470-
if c.options.OutFile != "" {
471-
// Just return, no t.Skip; this is unsupported so testing them is not helpful.
472-
return
473-
}
474-
475457
t.Run("sourcemap record", func(t *testing.T) {
476458
defer testutil.RecoverAndFail(t, "Panic on creating source map record for test "+c.filename)
477459
headerComponents := tspath.GetPathComponentsRelativeTo(repo.TestDataPath, c.filename, tspath.ComparePathsOptions{})
@@ -601,17 +583,3 @@ func (c *compilerTest) verifyParentPointers(t *testing.T) {
601583
}
602584
})
603585
}
604-
605-
func (c *compilerTest) containsUnsupportedOptionsForDiagnostics() bool {
606-
if len(c.result.Program.UnsupportedExtensions()) != 0 {
607-
return true
608-
}
609-
if c.options.BaseUrl != "" {
610-
return true
611-
}
612-
if c.options.OutFile != "" {
613-
return true
614-
}
615-
616-
return false
617-
}

internal/testutil/tsbaseline/type_symbol_baseline.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ func DoTypeAndSymbolBaseline(
9595

9696
return sb.String()[:sb.Len()-1]
9797
}
98-
typesOpts.IsSubmoduleAccepted = len(program.UnsupportedExtensions()) != 0 // TODO(jakebailey): read submoduleAccepted.txt
9998

10099
checkBaselines(t, baselinePath, allFiles, fullWalker, header, typesOpts, false /*isSymbolBaseline*/)
101100
})

0 commit comments

Comments
 (0)