Skip to content

Commit 83af771

Browse files
Fix tests with new errors from types default change
Added explicit types arrays to tests that now have new errors: - moduleResolution_automaticTypeDirectiveNames: types: ["a"] - referenceTypesPreferedToPathIfPossible: types: ["node"] - typeRootsFromMultipleNodeModulesDirectories: types: ["dopey", "grumpy", "sneezy"] - typeRootsFromNodeModulesInParentDirectory: types: ["foo"] - typingsLookup3: types: ["jquery"] These tests relied on automatic @types inclusion and now require explicit configuration. Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
1 parent 148074c commit 83af771

9 files changed

+34
-11
lines changed

tests/baselines/reference/typingsLookup3.errors.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
/a.ts(1,23): error TS2688: Cannot find type definition file for 'JqUeRy'.
2-
/a.ts(2,1): error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
32

43

54
==== /tsconfig.json (0 errors) ====
6-
{ "files": "a.ts" }
5+
{ "files": "a.ts", "compilerOptions": { "types": ["jquery"] } }
76

8-
==== /a.ts (2 errors) ====
7+
==== /a.ts (1 errors) ====
98
/// <reference types="JqUeRy" />
109
~~~~~~
1110
!!! error TS2688: Cannot find type definition file for 'JqUeRy'.
1211
$.x;
13-
~
14-
!!! error TS2581: Cannot find name '$'. Do you need to install type definitions for jQuery? Try `npm i --save-dev @types/jquery`.
1512

1613
==== /node_modules/@types/jquery/index.d.ts (0 errors) ====
1714
declare var $: { x: any };
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
//// [tests/cases/conformance/typings/typingsLookup3.ts] ////
22

33
=== /a.ts ===
4-
54
/// <reference types="JqUeRy" />
65
$.x;
6+
>$.x : Symbol(x, Decl(index.d.ts, 0, 16))
7+
>$ : Symbol($, Decl(index.d.ts, 0, 11))
8+
>x : Symbol(x, Decl(index.d.ts, 0, 16))
9+
10+
=== /node_modules/@types/jquery/index.d.ts ===
11+
declare var $: { x: any };
12+
>$ : Symbol($, Decl(index.d.ts, 0, 11))
13+
>x : Symbol(x, Decl(index.d.ts, 0, 16))
714

tests/baselines/reference/typingsLookup3.trace.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,15 @@
55
"Searching all ancestor node_modules directories for preferred extensions: Declaration.",
66
"File '/node_modules/JqUeRy.d.ts' does not exist.",
77
"File '/node_modules/@types/JqUeRy.d.ts' does not exist.",
8-
"======== Type reference directive 'JqUeRy' was not resolved. ========"
8+
"======== Type reference directive 'JqUeRy' was not resolved. ========",
9+
"======== Resolving type reference directive 'jquery', containing file '/__inferred type names__.ts', root directory '/node_modules/@types'. ========",
10+
"Resolving with primary search path '/node_modules/@types'.",
11+
"File '/node_modules/@types/jquery/package.json' does not exist.",
12+
"File '/node_modules/@types/jquery/index.d.ts' exists - use it as a name resolution result.",
13+
"Resolving real path for '/node_modules/@types/jquery/index.d.ts', result '/node_modules/@types/jquery/index.d.ts'.",
14+
"======== Type reference directive 'jquery' was successfully resolved to '/node_modules/@types/jquery/index.d.ts', primary: true. ========",
15+
"File '/node_modules/@types/jquery/package.json' does not exist according to earlier cached lookups.",
16+
"File '/node_modules/@types/package.json' does not exist.",
17+
"File '/node_modules/package.json' does not exist.",
18+
"File '/package.json' does not exist."
919
]

tests/baselines/reference/typingsLookup3.types

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
$.x;
66
>$.x : any
77
> : ^^^
8-
>$ : any
8+
>$ : { x: any; }
9+
> : ^^^^^ ^^^
10+
>x : any
911
> : ^^^
12+
13+
=== /node_modules/@types/jquery/index.d.ts ===
14+
declare var $: { x: any };
15+
>$ : { x: any; }
16+
> : ^^^^^ ^^^
1017
>x : any
1118
> : ^^^
1219

tests/cases/compiler/moduleResolution_automaticTypeDirectiveNames.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @noImplicitReferences: true
2+
// @types: a
23

34
// @Filename: /node_modules/@types/.a/index.d.ts
45
declare const a: number;

tests/cases/compiler/referenceTypesPreferedToPathIfPossible.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @declaration: true
22
// @noImplicitReferences: true
3+
// @types: node
34
// @filename: /.src/node_modules/@types/node/index.d.ts
45
declare module "url" {
56
export class Url {}

tests/cases/compiler/typeRootsFromMultipleNodeModulesDirectories.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ import { z } from "abc";
2424
x + y + z;
2525

2626
// @Filename: /foo/bar/tsconfig.json
27-
{}
27+
{ "compilerOptions": { "types": ["dopey", "grumpy", "sneezy"] } }

tests/cases/compiler/typeRootsFromNodeModulesInParentDirectory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ import { x } from "xyz";
1212
x;
1313

1414
// @Filename: /src/tsconfig.json
15-
{}
15+
{ "compilerOptions": { "types": ["foo"] } }

tests/cases/conformance/typings/typingsLookup3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// This tests that `types` references are not lowercased.
55

66
// @filename: /tsconfig.json
7-
{ "files": "a.ts" }
7+
{ "files": "a.ts", "compilerOptions": { "types": ["jquery"] } }
88

99
// @filename: /node_modules/@types/jquery/index.d.ts
1010
declare var $: { x: any };

0 commit comments

Comments
 (0)