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

testdata/baselines/reference/submodule/compiler/moduleResolutionWithExtensions_notSupported3.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 TS2307: Cannot find module './jsx' or its corresponding type declarations.
8+
9+
==== /jsx.jsx (0 errors) ====
810

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
+ import jsx from "./jsx";
1010
+ ~~~~~~~
1111
+!!! error TS2307: Cannot find module './jsx' or its corresponding type declarations.
12+
+
13+
+==== /jsx.jsx (0 errors) ====
1214
+

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

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

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

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

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ file1.ts(6,13): error TS2339: Property 'b' does not exist on type '{}'.
1717
~
1818
!!! error TS2339: Property 'b' does not exist on type '{}'.
1919
}
20+
21+
==== b.json (0 errors) ====
2022

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

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

testdata/baselines/reference/submodule/conformance/plainJSGrammarErrors3.errors.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/a.js(2,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules.
22

33

4+
==== plainJSGrammarErrors3.js (0 errors) ====
5+
46
==== /a.js (1 errors) ====
57
function foo() {
68
await new Promise(undefined);

testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment1.errors.txt.diff

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
+++ new.checkJsdocTypeTagOnExportAssignment1.errors.txt
33
@@= skipped -0, +0 lines =@@
44
-a.js(8,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'.
5-
-
6-
-
7-
-==== checkJsdocTypeTagOnExportAssignment1.js (0 errors) ====
8-
-
95
+a.js(8,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b
10-
+
11-
+
12-
==== a.js (1 errors) ====
13-
/**
14-
* @typedef {Object} Foo
15-
@@= skipped -11, +9 lines =@@
6+
7+
8+
==== checkJsdocTypeTagOnExportAssignment1.js (0 errors) ====
9+
@@= skipped -11, +11 lines =@@
1610

1711
/** @type {Foo} */
1812
export default { c: false };

testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment2.errors.txt.diff

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
+++ new.checkJsdocTypeTagOnExportAssignment2.errors.txt
33
@@= skipped -0, +0 lines =@@
44
-b.js(2,18): error TS2353: Object literal may only specify known properties, and 'c' does not exist in type 'Foo'.
5-
-
6-
-
7-
-==== checkJsdocTypeTagOnExportAssignment2.js (0 errors) ====
8-
-
95
+b.js(2,16): error TS2739: Type '{ c: boolean; }' is missing the following properties from type 'Foo': a, b
10-
+
11-
+
12-
==== a.ts (0 errors) ====
13-
export interface Foo {
14-
a: number;
15-
@@= skipped -11, +9 lines =@@
6+
7+
8+
==== checkJsdocTypeTagOnExportAssignment2.js (0 errors) ====
9+
@@= skipped -11, +11 lines =@@
1610
==== b.js (1 errors) ====
1711
/** @type {import("./a").Foo} */
1812
export default { c: false };

testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment3.errors.txt.diff

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

testdata/baselines/reference/submoduleAccepted/compiler/checkJsdocTypeTagOnExportAssignment4.errors.txt.diff

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
+++ new.checkJsdocTypeTagOnExportAssignment4.errors.txt
33
@@= skipped -0, +0 lines =@@
44
-a.js(6,16): error TS2322: Type 'string' is not assignable to type 'number'.
5-
-
6-
-
7-
-==== checkJsdocTypeTagOnExportAssignment4.js (0 errors) ====
8-
-
95
+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.
10-
+
11-
+
12-
==== a.js (1 errors) ====
13-
/**
14-
* @typedef {number} Foo
15-
@@= skipped -10, +8 lines =@@
6+
7+
8+
==== checkJsdocTypeTagOnExportAssignment4.js (0 errors) ====
9+
@@= skipped -10, +10 lines =@@
1610
/** @type {Foo} */
1711
export default "";
1812
~~

testdata/baselines/reference/submoduleAccepted/compiler/moduleResolutionWithExtensions_notSupported2.errors.txt.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import jsx from "./jsx";
1010
~~~~~~~
1111
-!!! error TS6142: Module './jsx' was resolved to '/jsx.jsx', but '--jsx' is not set.
12-
-
13-
-==== /jsx.jsx (0 errors) ====
1412
+!!! error TS2306: File '/jsx.jsx' is not a module.
13+
14+
==== /jsx.jsx (0 errors) ====
1515

testdata/baselines/reference/submoduleAccepted/conformance/plainJSGrammarErrors3.errors.txt.diff

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

0 commit comments

Comments
 (0)