Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test when module resolution includes .ts file from node_modules
- Loading branch information
1 parent
9509a54
commit 3df65a7
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/compositeWithNodeModulesSourceFile.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error TS6307: File '/foo/node_modules/myModule/index.ts' is not in project file list. Projects must list all files or use an 'include' pattern. | ||
|
||
|
||
!!! error TS6307: File '/foo/node_modules/myModule/index.ts' is not in project file list. Projects must list all files or use an 'include' pattern. | ||
==== /foo/tsconfig.json (0 errors) ==== | ||
{ | ||
"compilerOptions": { "composite": true }, | ||
"exclude": [ "node_modules" ] | ||
} | ||
|
||
==== /foo/test.ts (0 errors) ==== | ||
import myModule = require("myModule"); | ||
new myModule.c(); | ||
|
||
|
||
==== /foo/node_modules/myModule/index.ts (0 errors) ==== | ||
export class c { } | ||
|
20 changes: 20 additions & 0 deletions
20
tests/baselines/reference/compositeWithNodeModulesSourceFile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//// [tests/cases/compiler/compositeWithNodeModulesSourceFile.ts] //// | ||
|
||
//// [index.ts] | ||
export class c { } | ||
|
||
//// [test.ts] | ||
import myModule = require("myModule"); | ||
new myModule.c(); | ||
|
||
|
||
|
||
//// [test.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var myModule = require("myModule"); | ||
new myModule.c(); | ||
|
||
|
||
//// [test.d.ts] | ||
export {}; |
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/compositeWithNodeModulesSourceFile.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
=== /foo/test.ts === | ||
import myModule = require("myModule"); | ||
>myModule : Symbol(myModule, Decl(test.ts, 0, 0)) | ||
|
||
new myModule.c(); | ||
>myModule.c : Symbol(myModule.c, Decl(index.ts, 0, 0)) | ||
>myModule : Symbol(myModule, Decl(test.ts, 0, 0)) | ||
>c : Symbol(myModule.c, Decl(index.ts, 0, 0)) | ||
|
||
|
||
=== /foo/node_modules/myModule/index.ts === | ||
export class c { } | ||
>c : Symbol(c, Decl(index.ts, 0, 0)) | ||
|
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/compositeWithNodeModulesSourceFile.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
=== /foo/test.ts === | ||
import myModule = require("myModule"); | ||
>myModule : typeof myModule | ||
|
||
new myModule.c(); | ||
>new myModule.c() : myModule.c | ||
>myModule.c : typeof myModule.c | ||
>myModule : typeof myModule | ||
>c : typeof myModule.c | ||
|
||
|
||
=== /foo/node_modules/myModule/index.ts === | ||
export class c { } | ||
>c : c | ||
|
13 changes: 13 additions & 0 deletions
13
tests/cases/compiler/compositeWithNodeModulesSourceFile.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @filename: /foo/tsconfig.json | ||
{ | ||
"compilerOptions": { "composite": true }, | ||
"exclude": [ "node_modules" ] | ||
} | ||
|
||
// @filename: /foo/node_modules/myModule/index.ts | ||
export class c { } | ||
|
||
// @filename: /foo/test.ts | ||
import myModule = require("myModule"); | ||
new myModule.c(); | ||
|