diff --git a/tests/baselines/reference/commonSourceDirectory_dts.js b/tests/baselines/reference/commonSourceDirectory_dts.js new file mode 100644 index 00000000000..8aa0bd04e11 --- /dev/null +++ b/tests/baselines/reference/commonSourceDirectory_dts.js @@ -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] +/// +export const x = y; + + +//// [/app/bin/index.js] +"use strict"; +/// +exports.x = y; +//# sourceMappingURL=/app/myMapRoot/index.js.map + +//// [/app/bin/index.d.ts] +/// +export declare const x: number; diff --git a/tests/baselines/reference/commonSourceDirectory_dts.js.map b/tests/baselines/reference/commonSourceDirectory_dts.js.map new file mode 100644 index 00000000000..b33518dd04c --- /dev/null +++ b/tests/baselines/reference/commonSourceDirectory_dts.js.map @@ -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"} \ No newline at end of file diff --git a/tests/baselines/reference/commonSourceDirectory_dts.sourcemap.txt b/tests/baselines/reference/commonSourceDirectory_dts.sourcemap.txt new file mode 100644 index 00000000000..90603ae3652 --- /dev/null +++ b/tests/baselines/reference/commonSourceDirectory_dts.sourcemap.txt @@ -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"; +>>>/// +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +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 \ No newline at end of file diff --git a/tests/baselines/reference/commonSourceDirectory_dts.symbols b/tests/baselines/reference/commonSourceDirectory_dts.symbols new file mode 100644 index 00000000000..740a8aef921 --- /dev/null +++ b/tests/baselines/reference/commonSourceDirectory_dts.symbols @@ -0,0 +1,12 @@ +=== /app/src/index.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)) + diff --git a/tests/baselines/reference/commonSourceDirectory_dts.types b/tests/baselines/reference/commonSourceDirectory_dts.types new file mode 100644 index 00000000000..b41b91c978f --- /dev/null +++ b/tests/baselines/reference/commonSourceDirectory_dts.types @@ -0,0 +1,12 @@ +=== /app/src/index.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 + diff --git a/tests/cases/compiler/commonSourceDirectory_dts.ts b/tests/cases/compiler/commonSourceDirectory_dts.ts new file mode 100644 index 00000000000..3a3dfea1772 --- /dev/null +++ b/tests/cases/compiler/commonSourceDirectory_dts.ts @@ -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 +/// +export const x = y; + +// @filename: /app/tsconfig.json +{ + "compilerOptions": { + "outDir": "bin", + "sourceMap": true, + "mapRoot": "myMapRoot", + "sourceRoot": "mySourceRoot", + "declaration": true + } +}