mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-08 12:55:49 -05:00
Add test with a referenced dts file
This commit is contained in:
21
tests/baselines/reference/commonSourceDirectory_dts.js
Normal file
21
tests/baselines/reference/commonSourceDirectory_dts.js
Normal file
@@ -0,0 +1,21 @@
|
||||
//// [tests/cases/compiler/commonSourceDirectory_dts.ts] ////
|
||||
|
||||
//// [bar.d.ts]
|
||||
// Test that importing a file from `node_modules` does not affect calculation of the common source directory.
|
||||
|
||||
declare const y: number;
|
||||
|
||||
//// [index.ts]
|
||||
/// <reference path="../lib/bar.d.ts" />
|
||||
export const x = y;
|
||||
|
||||
|
||||
//// [/app/bin/index.js]
|
||||
"use strict";
|
||||
/// <reference path="../lib/bar.d.ts" />
|
||||
exports.x = y;
|
||||
//# sourceMappingURL=/app/myMapRoot/index.js.map
|
||||
|
||||
//// [/app/bin/index.d.ts]
|
||||
/// <reference path="../lib/bar.d.ts" />
|
||||
export declare const x: number;
|
||||
@@ -0,0 +1,2 @@
|
||||
//// [/app/bin/index.js.map]
|
||||
{"version":3,"file":"index.js","sourceRoot":"/app/mySourceRoot/","sources":["index.ts"],"names":[],"mappings":";AAAA,wCAAwC;AAC3B,QAAA,CAAC,GAAG,CAAC,CAAC"}
|
||||
@@ -0,0 +1,42 @@
|
||||
===================================================================
|
||||
JsFile: index.js
|
||||
mapUrl: /app/myMapRoot/index.js.map
|
||||
sourceRoot: /app/mySourceRoot/
|
||||
sources: index.ts
|
||||
===================================================================
|
||||
-------------------------------------------------------------------
|
||||
emittedFile:/app/bin/index.js
|
||||
sourceFile:index.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>"use strict";
|
||||
>>>/// <reference path="../lib/bar.d.ts" />
|
||||
1 >
|
||||
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1 >
|
||||
2 >/// <reference path="../lib/bar.d.ts" />
|
||||
1 >Emitted(2, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 41) Source(1, 41) + SourceIndex(0)
|
||||
---
|
||||
>>>exports.x = y;
|
||||
1 >
|
||||
2 >^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>export const
|
||||
2 >
|
||||
3 > x
|
||||
4 > =
|
||||
5 > y
|
||||
6 > ;
|
||||
1 >Emitted(3, 1) Source(2, 14) + SourceIndex(0)
|
||||
2 >Emitted(3, 9) Source(2, 14) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(2, 15) + SourceIndex(0)
|
||||
4 >Emitted(3, 13) Source(2, 18) + SourceIndex(0)
|
||||
5 >Emitted(3, 14) Source(2, 19) + SourceIndex(0)
|
||||
6 >Emitted(3, 15) Source(2, 20) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=/app/myMapRoot/index.js.map
|
||||
12
tests/baselines/reference/commonSourceDirectory_dts.symbols
Normal file
12
tests/baselines/reference/commonSourceDirectory_dts.symbols
Normal file
@@ -0,0 +1,12 @@
|
||||
=== /app/src/index.ts ===
|
||||
/// <reference path="../lib/bar.d.ts" />
|
||||
export const x = y;
|
||||
>x : Symbol(x, Decl(index.ts, 1, 12))
|
||||
>y : Symbol(y, Decl(bar.d.ts, 2, 13))
|
||||
|
||||
=== /app/lib/bar.d.ts ===
|
||||
// Test that importing a file from `node_modules` does not affect calculation of the common source directory.
|
||||
|
||||
declare const y: number;
|
||||
>y : Symbol(y, Decl(bar.d.ts, 2, 13))
|
||||
|
||||
12
tests/baselines/reference/commonSourceDirectory_dts.types
Normal file
12
tests/baselines/reference/commonSourceDirectory_dts.types
Normal file
@@ -0,0 +1,12 @@
|
||||
=== /app/src/index.ts ===
|
||||
/// <reference path="../lib/bar.d.ts" />
|
||||
export const x = y;
|
||||
>x : number
|
||||
>y : number
|
||||
|
||||
=== /app/lib/bar.d.ts ===
|
||||
// Test that importing a file from `node_modules` does not affect calculation of the common source directory.
|
||||
|
||||
declare const y: number;
|
||||
>y : number
|
||||
|
||||
22
tests/cases/compiler/commonSourceDirectory_dts.ts
Normal file
22
tests/cases/compiler/commonSourceDirectory_dts.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// Test that importing a file from `node_modules` does not affect calculation of the common source directory.
|
||||
// @noImplicitReferences: true
|
||||
// @moduleResolution: node
|
||||
// @fullEmitPaths: true
|
||||
|
||||
// @filename: /app/lib/bar.d.ts
|
||||
declare const y: number;
|
||||
|
||||
// @filename: /app/src/index.ts
|
||||
/// <reference path="../lib/bar.d.ts" />
|
||||
export const x = y;
|
||||
|
||||
// @filename: /app/tsconfig.json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "bin",
|
||||
"sourceMap": true,
|
||||
"mapRoot": "myMapRoot",
|
||||
"sourceRoot": "mySourceRoot",
|
||||
"declaration": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user