Skip to content

Commit 1607c83

Browse files
authored
Fix error baselines for empty files (#1014)
1 parent e7a30f5 commit 1607c83

23 files changed

+45
-89
lines changed

internal/testutil/tsbaseline/error_baseline.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ func iterateErrorBaseline(t *testing.T, inputFiles []*harnessutil.TestFile, inpu
152152

153153
// 'merge' the lines of each input file with any errors associated with it
154154
dupeCase := map[string]int{}
155-
nonEmptyFiles := core.Filter(inputFiles, func(f *harnessutil.TestFile) bool { return len(f.Content) > 0 })
156-
for _, inputFile := range nonEmptyFiles {
155+
for _, inputFile := range inputFiles {
157156
// Filter down to the errors in the file
158157
fileErrors := core.Filter(diagnostics, func(e *ast.Diagnostic) bool {
159158
return e.File() != nil &&

testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
a.js(8,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b
22

33

4+
==== checkJsdocTypeTagOnExportAssignment1.js (0 errors) ====
5+
46
==== a.js (1 errors) ====
57
/**
68
* @typedef {Object} Foo

testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
b.js(2,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b
22

33

4+
==== checkJsdocTypeTagOnExportAssignment2.js (0 errors) ====
5+
46
==== a.ts (0 errors) ====
57
export interface Foo {
68
a: number;

testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
a.js(10,16): error TS2739: Type '{ c: number; }' is missing the following properties from type 'Foo': a, b
22

33

4+
==== checkJsdocTypeTagOnExportAssignment3.js (0 errors) ====
5+
46
==== a.js (1 errors) ====
57
/**
68
* @typedef {Object} Foo

testdata/baselines/reference/submodule/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
a.js(6,16): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
22

33

4+
==== checkJsdocTypeTagOnExportAssignment4.js (0 errors) ====
5+
46
==== a.js (1 errors) ====
57
/**
68
* @typedef {number} Foo

testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
==== /tests/node_modules/@types/react/package.json (0 errors) ====
2222
{ "name": "@types/react", "version": "16.4.6" }
23+
==== /tests/node_modules/@types/react/index.d.ts (0 errors) ====
24+
2325
==== /node_modules/@types/react/package.json (0 errors) ====
2426
{ "name": "@types/react", "version": "16.4.6" }
2527
==== /node_modules/@types/react/index.d.ts (1 errors) ====

testdata/baselines/reference/submodule/compiler/duplicatePackage_globalMerge.errors.txt.diff

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

testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,10 @@
1313
import js from "./js"; // OK because it's an untyped module.
1414
~~~~~~
1515
!!! error TS2307: Cannot find module './js' or its corresponding type declarations.
16+
17+
==== /tsx.tsx (0 errors) ====
18+
19+
==== /jsx.jsx (0 errors) ====
20+
21+
==== /js.js (0 errors) ====
1622

testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported.errors.txt.diff

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@
2121
-!!! error TS6142: Module './jsx' was resolved to '/jsx.jsx', but '--jsx' is not set.
2222
+!!! error TS2307: Cannot find module './jsx' or its corresponding type declarations.
2323
import js from "./js"; // OK because it's an untyped module.
24-
-
25-
-==== /tsx.tsx (0 errors) ====
26-
-
27-
-==== /jsx.jsx (0 errors) ====
28-
-
29-
-==== /js.js (0 errors) ====
3024
+ ~~~~~~
3125
+!!! error TS2307: Cannot find module './js' or its corresponding type declarations.
26+
27+
==== /tsx.tsx (0 errors) ====
3228

testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported2.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
import jsx from "./jsx";
66
~~~~~~~
77
!!! error TS2306: File '/jsx.jsx' is not a module.
8+
9+
==== /jsx.jsx (0 errors) ====
810

0 commit comments

Comments
 (0)