Add another test to generate baseline when sample's logic config file changes declaration dir

This commit is contained in:
Sheetal Nandi 2019-02-07 10:14:38 -08:00
parent ee9d3439a1
commit 3a28fb0786
7 changed files with 818 additions and 40 deletions

View File

@ -4,6 +4,11 @@ namespace ts {
const brackets = createBracketsMap();
const syntheticParent: TextRange = { pos: -1, end: -1 };
/*@internal*/
export function isInfoFile(file: string) {
return endsWith(file, `/${infoFile}`);
}
/*@internal*/
/**
* Iterates over the source files that are expected to have an emit output.

View File

@ -120,7 +120,7 @@ namespace ts {
baselineRecorder.WriteLine("======================================================================");
}
function build({ fs, tick, rootNames, expectedMapFileNames, expectedTsbuildInfoFileNames, modifyFs, withoutBuildInfo, expectedDiagnostics }: {
function build({ fs, tick, rootNames, expectedMapFileNames, expectedTsbuildInfoFileNames, modifyFs, withoutBuildInfo }: {
fs: vfs.FileSystem;
tick: () => void;
rootNames: ReadonlyArray<string>;
@ -128,7 +128,6 @@ namespace ts {
expectedTsbuildInfoFileNames: ReadonlyArray<BuildInfoSectionBaselineFiles>;
modifyFs: (fs: vfs.FileSystem) => void;
withoutBuildInfo: boolean;
expectedDiagnostics: ReadonlyArray<fakes.ExpectedDiagnostic>;
}) {
const actualReadFileMap = createMap<number>();
modifyFs(fs);
@ -143,7 +142,7 @@ namespace ts {
if (path.startsWith("/src/")) {
actualReadFileMap.set(path, (actualReadFileMap.get(path) || 0) + 1);
}
if (withoutBuildInfo && getBaseFileName(path) === infoFile) {
if (withoutBuildInfo && isInfoFile(path)) {
return undefined;
}
return originalReadFile.call(host, path);
@ -151,12 +150,11 @@ namespace ts {
if (withoutBuildInfo) {
const originalWriteFile = host.writeFile;
host.writeFile = (fileName, content, writeByteOrder) => {
return getBaseFileName(fileName) !== infoFile &&
return !isInfoFile(fileName) &&
originalWriteFile.call(host, fileName, content, writeByteOrder);
};
}
builder.buildAllProjects();
host.assertDiagnosticMessages(...expectedDiagnostics);
generateSourceMapBaselineFiles(fs, expectedMapFileNames);
generateBuildInfoSectionBaselineFiles(fs, expectedTsbuildInfoFileNames);
fs.makeReadonly();
@ -174,9 +172,9 @@ namespace ts {
expectedReadFiles.forEach((expected, expectedFile) => {
const actual = actualReadFileMap.get(expectedFile);
assert.equal(actual, expected, `Mismatch in read file call number for: ${expectedFile}
Not in Actual: ${JSON.stringify(mapDefinedIterator(expectedReadFiles.keys(), f => actualReadFileMap.has(f) ? undefined : f))}
Mismatch Actual(path, actual, expected): ${JSON.stringify(mapDefinedIterator(actualReadFileMap.entries(),
([p, v]) => expectedReadFiles.get(p) !== v ? [p, v, expectedReadFiles.get(p) || 0] : undefined))}`);
Not in Actual: ${JSON.stringify(arrayFrom(mapDefinedIterator(expectedReadFiles.keys(), f => actualReadFileMap.has(f) ? undefined : f)))}
Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIterator(actualReadFileMap.entries(),
([p, v]) => expectedReadFiles.get(p) !== v ? [p, v, expectedReadFiles.get(p) || 0] : undefined)))}`);
});
}
@ -218,14 +216,15 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(mapDefinedIterator(act
withoutBuildInfo: boolean;
lastProjectOutputJs: string;
initialBuild: ExpectedBuildOutputNotDifferingWithBuildInfo;
incrementalDtsChangedBuild: ExpectedBuildOutputNotDifferingWithBuildInfo;
incrementalDtsUnchangedBuild: ExpectedBuildOutputDifferingWithBuildInfo;
incrementalDtsChangedBuild?: ExpectedBuildOutputNotDifferingWithBuildInfo;
incrementalDtsUnchangedBuild?: ExpectedBuildOutputDifferingWithBuildInfo;
incrementalHeaderChangedBuild?: ExpectedBuildOutputDifferingWithBuildInfo;
}) {
describe(`${proj}:: ${scenario}${withoutBuildInfo ? " without build info" : ""}`, () => {
describe(`tsc --b ${proj}:: ${scenario}${withoutBuildInfo ? " without build info" : ""}`, () => {
let fs: vfs.FileSystem;
let actualReadFileMap: Map<number>;
let firstBuildTime: number;
let host: fakes.SolutionBuilderHost;
before(() => {
const result = build({
fs: projFs().shadow(),
@ -235,16 +234,19 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(mapDefinedIterator(act
expectedTsbuildInfoFileNames,
modifyFs: initialBuild.modifyFs,
withoutBuildInfo,
expectedDiagnostics: initialBuild.expectedDiagnostics
});
({ fs, actualReadFileMap } = result);
({ fs, actualReadFileMap, host } = result);
firstBuildTime = time();
});
after(() => {
fs = undefined!;
actualReadFileMap = undefined!;
host = undefined!;
});
describe("initialBuild", () => {
it(`verify diagnostics`, () => {
host.assertDiagnosticMessages(...initialBuild.expectedDiagnostics);
});
it(`Generates files matching the baseline`, () => {
generateBaseline(fs, proj, scenario, "initial Build", withoutBuildInfo, projFs());
});
@ -259,26 +261,30 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(mapDefinedIterator(act
describe(subScenario, () => {
let newFs: vfs.FileSystem;
let actualReadFileMap: Map<number>;
let host: fakes.SolutionBuilderHost;
before(() => {
assert.equal(fs.statSync(lastProjectOutputJs).mtimeMs, firstBuildTime, "First build timestamp is correct");
tick();
newFs = fs.shadow();
tick();
({ actualReadFileMap } = build({
({ actualReadFileMap, host } = build({
fs: newFs,
tick,
rootNames,
expectedMapFileNames,
expectedTsbuildInfoFileNames,
modifyFs: incrementalModifyFs,
withoutBuildInfo,
expectedDiagnostics: incrementalExpectedDiagnostics
withoutBuildInfo
}));
assert.equal(newFs.statSync(lastProjectOutputJs).mtimeMs, time(), "Second build timestamp is correct");
});
after(() => {
newFs = undefined!;
actualReadFileMap = undefined!;
host = undefined!;
});
it(`verify diagnostics`, () => {
host.assertDiagnosticMessages(...incrementalExpectedDiagnostics);
});
it(`Generates files matching the baseline`, () => {
generateBaseline(newFs, proj, scenario, subScenario, withoutBuildInfo, fs);
@ -290,20 +296,23 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(mapDefinedIterator(act
}
});
}
if (incrementalDtsChangedBuild) {
incrementalBuild(
"incremental declaration changes",
incrementalDtsChangedBuild.modifyFs,
incrementalDtsChangedBuild.expectedDiagnostics,
incrementalDtsChangedBuild.expectedReadFiles
);
}
incrementalBuild(
"incremental declaration changes",
incrementalDtsChangedBuild.modifyFs,
incrementalDtsChangedBuild.expectedDiagnostics,
incrementalDtsChangedBuild.expectedReadFiles
);
incrementalBuild(
"incremental declaration doesnt change",
incrementalDtsUnchangedBuild.modifyFs,
(withoutBuildInfo ? incrementalDtsUnchangedBuild.withoutBuildInfo : incrementalDtsUnchangedBuild.withBuildInfo).expectedDiagnostics,
(withoutBuildInfo ? incrementalDtsUnchangedBuild.withoutBuildInfo : incrementalDtsUnchangedBuild.withBuildInfo).expectedReadFiles
);
if (incrementalDtsUnchangedBuild) {
incrementalBuild(
"incremental declaration doesnt change",
incrementalDtsUnchangedBuild.modifyFs,
(withoutBuildInfo ? incrementalDtsUnchangedBuild.withoutBuildInfo : incrementalDtsUnchangedBuild.withBuildInfo).expectedDiagnostics,
(withoutBuildInfo ? incrementalDtsUnchangedBuild.withoutBuildInfo : incrementalDtsUnchangedBuild.withBuildInfo).expectedReadFiles
);
}
if (incrementalHeaderChangedBuild) {
incrementalBuild(
@ -327,8 +336,8 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(mapDefinedIterator(act
expectedTsbuildInfoFileNames: ReadonlyArray<BuildInfoSectionBaselineFiles>;
lastProjectOutputJs: string;
initialBuild: ExpectedBuildOutputNotDifferingWithBuildInfo;
incrementalDtsChangedBuild: ExpectedBuildOutputNotDifferingWithBuildInfo;
incrementalDtsUnchangedBuild: ExpectedBuildOutputDifferingWithBuildInfo;
incrementalDtsChangedBuild?: ExpectedBuildOutputNotDifferingWithBuildInfo;
incrementalDtsUnchangedBuild?: ExpectedBuildOutputDifferingWithBuildInfo;
incrementalHeaderChangedBuild?: ExpectedBuildOutputDifferingWithBuildInfo;
}) {
verifyTsbuildOutputWorker({ ...input, withoutBuildInfo: false });

View File

@ -359,6 +359,16 @@ export class cNew {}`);
});
describe("emit output", () => {
const initialBuildDiagnostics: ReadonlyArray<fakes.ExpectedDiagnostic> = [
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
];
verifyTsbuildOutput({
scenario: "sample",
projFs: () => projFs,
@ -375,15 +385,7 @@ export class cNew {}`);
lastProjectOutputJs: "/src/tests/index.js",
initialBuild: {
modifyFs: noop,
expectedDiagnostics: [
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/core/anotherModule.js"],
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/index.js"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/tests/tsconfig.json", "src/tests/index.js"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"]
]
expectedDiagnostics: initialBuildDiagnostics
},
incrementalDtsChangedBuild: {
modifyFs: fs => appendText(fs, "/src/core/index.ts", `
@ -425,6 +427,38 @@ class someClass { }`),
}
}
});
verifyTsbuildOutput({
scenario: "when logic config changes declaration dir",
projFs: () => projFs,
time,
tick,
proj: "sample1",
rootNames: ["/src/tests"],
expectedMapFileNames: [
"/src/core/anotherModule.d.ts.map",
"/src/core/index.d.ts.map",
"/src/logic/index.js.map"
],
expectedTsbuildInfoFileNames: emptyArray,
lastProjectOutputJs: "/src/tests/index.js",
initialBuild: {
modifyFs: noop,
expectedDiagnostics: initialBuildDiagnostics
},
incrementalDtsChangedBuild: {
modifyFs: fs => replaceText(fs, "/src/logic/tsconfig.json", `"declaration": true,`, `"declaration": true,
"declarationDir": "decls"`),
expectedDiagnostics: [
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/logic/tsconfig.json", "src/tests/tsconfig.json"),
[Diagnostics.Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2, "src/core/tsconfig.json", "src/core/anotherModule.ts", "src/core/anotherModule.js"],
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/logic/tsconfig.json", "src/logic/decls/index.d.ts"],
[Diagnostics.Building_project_0, "/src/logic/tsconfig.json"],
[Diagnostics.Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2, "src/tests/tsconfig.json", "src/tests/index.js", "src/logic"],
[Diagnostics.Building_project_0, "/src/tests/tsconfig.json"],
]
}
});
});
});
}

View File

@ -0,0 +1,22 @@
//// [/src/logic/decls/index.d.ts]
export declare function getSecondsInDay(): number;
import * as mod from '../core/anotherModule';
export declare const m: typeof mod;
//// [/src/logic/tsconfig.json]
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationDir": "decls"
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"skipDefaultLibCheck": true
},
"references": [
{ "path": "../core" }
]
}

View File

@ -0,0 +1,22 @@
//// [/src/logic/decls/index.d.ts]
export declare function getSecondsInDay(): number;
import * as mod from '../core/anotherModule';
export declare const m: typeof mod;
//// [/src/logic/tsconfig.json]
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationDir": "decls"
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"skipDefaultLibCheck": true
},
"references": [
{ "path": "../core" }
]
}

View File

@ -0,0 +1,343 @@
//// [/src/core/anotherModule.d.ts]
export declare const World = "hello";
//# sourceMappingURL=anotherModule.d.ts.map
//// [/src/core/anotherModule.d.ts.map]
{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"}
//// [/src/core/anotherModule.d.ts.map.baseline.txt]
===================================================================
JsFile: anotherModule.d.ts
mapUrl: anotherModule.d.ts.map
sourceRoot:
sources: anotherModule.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/core/anotherModule.d.ts
sourceFile:anotherModule.ts
-------------------------------------------------------------------
>>>export declare const World = "hello";
1 >
2 >^^^^^^^^^^^^^^^
3 > ^^^^^^
4 > ^^^^^
5 > ^^^^^^^^^^
6 > ^
7 > ^^^^^->
1 >
2 >export
3 > const
4 > World
5 > = "hello"
6 > ;
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 16) Source(1, 8) + SourceIndex(0)
3 >Emitted(1, 22) Source(1, 14) + SourceIndex(0)
4 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
5 >Emitted(1, 37) Source(1, 29) + SourceIndex(0)
6 >Emitted(1, 38) Source(1, 30) + SourceIndex(0)
---
>>>//# sourceMappingURL=anotherModule.d.ts.map
//// [/src/core/anotherModule.js]
"use strict";
exports.__esModule = true;
exports.World = "hello";
//// [/src/core/index.d.ts]
export declare const someString: string;
export declare function leftPad(s: string, n: number): string;
export declare function multiply(a: number, b: number): number;
//# sourceMappingURL=index.d.ts.map
//// [/src/core/index.d.ts.map]
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"}
//// [/src/core/index.d.ts.map.baseline.txt]
===================================================================
JsFile: index.d.ts
mapUrl: index.d.ts.map
sourceRoot:
sources: index.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/core/index.d.ts
sourceFile:index.ts
-------------------------------------------------------------------
>>>export declare const someString: string;
1 >
2 >^^^^^^^^^^^^^^^
3 > ^^^^^^
4 > ^^^^^^^^^^
5 > ^^
6 > ^^^^^^
7 > ^
8 > ^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >export
3 > const
4 > someString
5 > :
6 > string = "HELLO WORLD"
7 > ;
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 16) Source(1, 8) + SourceIndex(0)
3 >Emitted(1, 22) Source(1, 14) + SourceIndex(0)
4 >Emitted(1, 32) Source(1, 24) + SourceIndex(0)
5 >Emitted(1, 34) Source(1, 26) + SourceIndex(0)
6 >Emitted(1, 40) Source(1, 48) + SourceIndex(0)
7 >Emitted(1, 41) Source(1, 49) + SourceIndex(0)
---
>>>export declare function leftPad(s: string, n: number): string;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^^^^^^
4 > ^
5 > ^
6 > ^^
7 > ^^^^^^
8 > ^^
9 > ^
10> ^^
11> ^^^^^^
12> ^^^^^^^^^^
13> ^^->
1->
>
2 >export function
3 > leftPad
4 > (
5 > s
6 > :
7 > string
8 > ,
9 > n
10> :
11> number
12> ) { return s + n; }
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 25) Source(2, 17) + SourceIndex(0)
3 >Emitted(2, 32) Source(2, 24) + SourceIndex(0)
4 >Emitted(2, 33) Source(2, 25) + SourceIndex(0)
5 >Emitted(2, 34) Source(2, 26) + SourceIndex(0)
6 >Emitted(2, 36) Source(2, 28) + SourceIndex(0)
7 >Emitted(2, 42) Source(2, 34) + SourceIndex(0)
8 >Emitted(2, 44) Source(2, 36) + SourceIndex(0)
9 >Emitted(2, 45) Source(2, 37) + SourceIndex(0)
10>Emitted(2, 47) Source(2, 39) + SourceIndex(0)
11>Emitted(2, 53) Source(2, 45) + SourceIndex(0)
12>Emitted(2, 63) Source(2, 64) + SourceIndex(0)
---
>>>export declare function multiply(a: number, b: number): number;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^^^^^^^
4 > ^
5 > ^
6 > ^^
7 > ^^^^^^
8 > ^^
9 > ^
10> ^^
11> ^^^^^^
12> ^^^^^^^^^^
1->
>
2 >export function
3 > multiply
4 > (
5 > a
6 > :
7 > number
8 > ,
9 > b
10> :
11> number
12> ) { return a * b; }
1->Emitted(3, 1) Source(3, 1) + SourceIndex(0)
2 >Emitted(3, 25) Source(3, 17) + SourceIndex(0)
3 >Emitted(3, 33) Source(3, 25) + SourceIndex(0)
4 >Emitted(3, 34) Source(3, 26) + SourceIndex(0)
5 >Emitted(3, 35) Source(3, 27) + SourceIndex(0)
6 >Emitted(3, 37) Source(3, 29) + SourceIndex(0)
7 >Emitted(3, 43) Source(3, 35) + SourceIndex(0)
8 >Emitted(3, 45) Source(3, 37) + SourceIndex(0)
9 >Emitted(3, 46) Source(3, 38) + SourceIndex(0)
10>Emitted(3, 48) Source(3, 40) + SourceIndex(0)
11>Emitted(3, 54) Source(3, 46) + SourceIndex(0)
12>Emitted(3, 64) Source(3, 65) + SourceIndex(0)
---
>>>//# sourceMappingURL=index.d.ts.map
//// [/src/core/index.js]
"use strict";
exports.__esModule = true;
exports.someString = "HELLO WORLD";
function leftPad(s, n) { return s + n; }
exports.leftPad = leftPad;
function multiply(a, b) { return a * b; }
exports.multiply = multiply;
//// [/src/logic/index.d.ts]
export declare function getSecondsInDay(): number;
import * as mod from '../core/anotherModule';
export declare const m: typeof mod;
//// [/src/logic/index.js]
"use strict";
exports.__esModule = true;
var c = require("../core/index");
function getSecondsInDay() {
return c.multiply(10, 15);
}
exports.getSecondsInDay = getSecondsInDay;
var mod = require("../core/anotherModule");
exports.m = mod;
//# sourceMappingURL=index.js.map
//// [/src/logic/index.js.map]
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"}
//// [/src/logic/index.js.map.baseline.txt]
===================================================================
JsFile: index.js
mapUrl: index.js.map
sourceRoot:
sources: index.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/logic/index.js
sourceFile:index.ts
-------------------------------------------------------------------
>>>"use strict";
>>>exports.__esModule = true;
>>>var c = require("../core/index");
1 >
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 >
2 >import * as c from '../core/index';
1 >Emitted(3, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(3, 34) Source(1, 36) + SourceIndex(0)
---
>>>function getSecondsInDay() {
1 >
2 >^^^^^^^^^
3 > ^^^^^^^^^^^^^^^
4 > ^^^^^^^->
1 >
>
2 >export function
3 > getSecondsInDay
1 >Emitted(4, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(4, 10) Source(2, 17) + SourceIndex(0)
3 >Emitted(4, 25) Source(2, 32) + SourceIndex(0)
---
>>> return c.multiply(10, 15);
1->^^^^
2 > ^^^^^^^
3 > ^
4 > ^
5 > ^^^^^^^^
6 > ^
7 > ^^
8 > ^^
9 > ^^
10> ^
11> ^
1->() {
>
2 > return
3 > c
4 > .
5 > multiply
6 > (
7 > 10
8 > ,
9 > 15
10> )
11> ;
1->Emitted(5, 5) Source(3, 5) + SourceIndex(0)
2 >Emitted(5, 12) Source(3, 12) + SourceIndex(0)
3 >Emitted(5, 13) Source(3, 13) + SourceIndex(0)
4 >Emitted(5, 14) Source(3, 14) + SourceIndex(0)
5 >Emitted(5, 22) Source(3, 22) + SourceIndex(0)
6 >Emitted(5, 23) Source(3, 23) + SourceIndex(0)
7 >Emitted(5, 25) Source(3, 25) + SourceIndex(0)
8 >Emitted(5, 27) Source(3, 27) + SourceIndex(0)
9 >Emitted(5, 29) Source(3, 29) + SourceIndex(0)
10>Emitted(5, 30) Source(3, 30) + SourceIndex(0)
11>Emitted(5, 31) Source(3, 31) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0)
2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0)
---
>>>exports.getSecondsInDay = getSecondsInDay;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^->
1->
2 >export function getSecondsInDay() {
> return c.multiply(10, 15);
>}
1->Emitted(7, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(7, 43) Source(4, 2) + SourceIndex(0)
---
>>>var mod = require("../core/anotherModule");
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1->
>
2 >import * as mod from '../core/anotherModule';
1->Emitted(8, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(8, 44) Source(5, 46) + SourceIndex(0)
---
>>>exports.m = mod;
1 >
2 >^^^^^^^^
3 > ^
4 > ^^^
5 > ^^^
6 > ^
7 > ^^^^^^^^^^^^^^^^->
1 >
>export const
2 >
3 > m
4 > =
5 > mod
6 > ;
1 >Emitted(9, 1) Source(6, 14) + SourceIndex(0)
2 >Emitted(9, 9) Source(6, 14) + SourceIndex(0)
3 >Emitted(9, 10) Source(6, 15) + SourceIndex(0)
4 >Emitted(9, 13) Source(6, 18) + SourceIndex(0)
5 >Emitted(9, 16) Source(6, 21) + SourceIndex(0)
6 >Emitted(9, 17) Source(6, 22) + SourceIndex(0)
---
>>>//# sourceMappingURL=index.js.map
//// [/src/tests/index.d.ts]
import * as mod from '../core/anotherModule';
export declare const m: typeof mod;
//// [/src/tests/index.js]
"use strict";
exports.__esModule = true;
var c = require("../core/index");
var logic = require("../logic/index");
c.leftPad("", 10);
logic.getSecondsInDay();
var mod = require("../core/anotherModule");
exports.m = mod;

View File

@ -0,0 +1,343 @@
//// [/src/core/anotherModule.d.ts]
export declare const World = "hello";
//# sourceMappingURL=anotherModule.d.ts.map
//// [/src/core/anotherModule.d.ts.map]
{"version":3,"file":"anotherModule.d.ts","sourceRoot":"","sources":["anotherModule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,UAAU,CAAC"}
//// [/src/core/anotherModule.d.ts.map.baseline.txt]
===================================================================
JsFile: anotherModule.d.ts
mapUrl: anotherModule.d.ts.map
sourceRoot:
sources: anotherModule.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/core/anotherModule.d.ts
sourceFile:anotherModule.ts
-------------------------------------------------------------------
>>>export declare const World = "hello";
1 >
2 >^^^^^^^^^^^^^^^
3 > ^^^^^^
4 > ^^^^^
5 > ^^^^^^^^^^
6 > ^
7 > ^^^^^->
1 >
2 >export
3 > const
4 > World
5 > = "hello"
6 > ;
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 16) Source(1, 8) + SourceIndex(0)
3 >Emitted(1, 22) Source(1, 14) + SourceIndex(0)
4 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
5 >Emitted(1, 37) Source(1, 29) + SourceIndex(0)
6 >Emitted(1, 38) Source(1, 30) + SourceIndex(0)
---
>>>//# sourceMappingURL=anotherModule.d.ts.map
//// [/src/core/anotherModule.js]
"use strict";
exports.__esModule = true;
exports.World = "hello";
//// [/src/core/index.d.ts]
export declare const someString: string;
export declare function leftPad(s: string, n: number): string;
export declare function multiply(a: number, b: number): number;
//# sourceMappingURL=index.d.ts.map
//// [/src/core/index.d.ts.map]
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,EAAE,MAAsB,CAAC;AAChD,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"}
//// [/src/core/index.d.ts.map.baseline.txt]
===================================================================
JsFile: index.d.ts
mapUrl: index.d.ts.map
sourceRoot:
sources: index.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/core/index.d.ts
sourceFile:index.ts
-------------------------------------------------------------------
>>>export declare const someString: string;
1 >
2 >^^^^^^^^^^^^^^^
3 > ^^^^^^
4 > ^^^^^^^^^^
5 > ^^
6 > ^^^^^^
7 > ^
8 > ^^^^^^^^^^^^^^^^^^^^^^^->
1 >
2 >export
3 > const
4 > someString
5 > :
6 > string = "HELLO WORLD"
7 > ;
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 16) Source(1, 8) + SourceIndex(0)
3 >Emitted(1, 22) Source(1, 14) + SourceIndex(0)
4 >Emitted(1, 32) Source(1, 24) + SourceIndex(0)
5 >Emitted(1, 34) Source(1, 26) + SourceIndex(0)
6 >Emitted(1, 40) Source(1, 48) + SourceIndex(0)
7 >Emitted(1, 41) Source(1, 49) + SourceIndex(0)
---
>>>export declare function leftPad(s: string, n: number): string;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^^^^^^
4 > ^
5 > ^
6 > ^^
7 > ^^^^^^
8 > ^^
9 > ^
10> ^^
11> ^^^^^^
12> ^^^^^^^^^^
13> ^^->
1->
>
2 >export function
3 > leftPad
4 > (
5 > s
6 > :
7 > string
8 > ,
9 > n
10> :
11> number
12> ) { return s + n; }
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(2, 25) Source(2, 17) + SourceIndex(0)
3 >Emitted(2, 32) Source(2, 24) + SourceIndex(0)
4 >Emitted(2, 33) Source(2, 25) + SourceIndex(0)
5 >Emitted(2, 34) Source(2, 26) + SourceIndex(0)
6 >Emitted(2, 36) Source(2, 28) + SourceIndex(0)
7 >Emitted(2, 42) Source(2, 34) + SourceIndex(0)
8 >Emitted(2, 44) Source(2, 36) + SourceIndex(0)
9 >Emitted(2, 45) Source(2, 37) + SourceIndex(0)
10>Emitted(2, 47) Source(2, 39) + SourceIndex(0)
11>Emitted(2, 53) Source(2, 45) + SourceIndex(0)
12>Emitted(2, 63) Source(2, 64) + SourceIndex(0)
---
>>>export declare function multiply(a: number, b: number): number;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^^^^^^^
4 > ^
5 > ^
6 > ^^
7 > ^^^^^^
8 > ^^
9 > ^
10> ^^
11> ^^^^^^
12> ^^^^^^^^^^
1->
>
2 >export function
3 > multiply
4 > (
5 > a
6 > :
7 > number
8 > ,
9 > b
10> :
11> number
12> ) { return a * b; }
1->Emitted(3, 1) Source(3, 1) + SourceIndex(0)
2 >Emitted(3, 25) Source(3, 17) + SourceIndex(0)
3 >Emitted(3, 33) Source(3, 25) + SourceIndex(0)
4 >Emitted(3, 34) Source(3, 26) + SourceIndex(0)
5 >Emitted(3, 35) Source(3, 27) + SourceIndex(0)
6 >Emitted(3, 37) Source(3, 29) + SourceIndex(0)
7 >Emitted(3, 43) Source(3, 35) + SourceIndex(0)
8 >Emitted(3, 45) Source(3, 37) + SourceIndex(0)
9 >Emitted(3, 46) Source(3, 38) + SourceIndex(0)
10>Emitted(3, 48) Source(3, 40) + SourceIndex(0)
11>Emitted(3, 54) Source(3, 46) + SourceIndex(0)
12>Emitted(3, 64) Source(3, 65) + SourceIndex(0)
---
>>>//# sourceMappingURL=index.d.ts.map
//// [/src/core/index.js]
"use strict";
exports.__esModule = true;
exports.someString = "HELLO WORLD";
function leftPad(s, n) { return s + n; }
exports.leftPad = leftPad;
function multiply(a, b) { return a * b; }
exports.multiply = multiply;
//// [/src/logic/index.d.ts]
export declare function getSecondsInDay(): number;
import * as mod from '../core/anotherModule';
export declare const m: typeof mod;
//// [/src/logic/index.js]
"use strict";
exports.__esModule = true;
var c = require("../core/index");
function getSecondsInDay() {
return c.multiply(10, 15);
}
exports.getSecondsInDay = getSecondsInDay;
var mod = require("../core/anotherModule");
exports.m = mod;
//# sourceMappingURL=index.js.map
//// [/src/logic/index.js.map]
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,iCAAmC;AACnC,SAAgB,eAAe;IAC3B,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAFD,0CAEC;AACD,2CAA6C;AAChC,QAAA,CAAC,GAAG,GAAG,CAAC"}
//// [/src/logic/index.js.map.baseline.txt]
===================================================================
JsFile: index.js
mapUrl: index.js.map
sourceRoot:
sources: index.ts
===================================================================
-------------------------------------------------------------------
emittedFile:/src/logic/index.js
sourceFile:index.ts
-------------------------------------------------------------------
>>>"use strict";
>>>exports.__esModule = true;
>>>var c = require("../core/index");
1 >
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 >
2 >import * as c from '../core/index';
1 >Emitted(3, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(3, 34) Source(1, 36) + SourceIndex(0)
---
>>>function getSecondsInDay() {
1 >
2 >^^^^^^^^^
3 > ^^^^^^^^^^^^^^^
4 > ^^^^^^^->
1 >
>
2 >export function
3 > getSecondsInDay
1 >Emitted(4, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(4, 10) Source(2, 17) + SourceIndex(0)
3 >Emitted(4, 25) Source(2, 32) + SourceIndex(0)
---
>>> return c.multiply(10, 15);
1->^^^^
2 > ^^^^^^^
3 > ^
4 > ^
5 > ^^^^^^^^
6 > ^
7 > ^^
8 > ^^
9 > ^^
10> ^
11> ^
1->() {
>
2 > return
3 > c
4 > .
5 > multiply
6 > (
7 > 10
8 > ,
9 > 15
10> )
11> ;
1->Emitted(5, 5) Source(3, 5) + SourceIndex(0)
2 >Emitted(5, 12) Source(3, 12) + SourceIndex(0)
3 >Emitted(5, 13) Source(3, 13) + SourceIndex(0)
4 >Emitted(5, 14) Source(3, 14) + SourceIndex(0)
5 >Emitted(5, 22) Source(3, 22) + SourceIndex(0)
6 >Emitted(5, 23) Source(3, 23) + SourceIndex(0)
7 >Emitted(5, 25) Source(3, 25) + SourceIndex(0)
8 >Emitted(5, 27) Source(3, 27) + SourceIndex(0)
9 >Emitted(5, 29) Source(3, 29) + SourceIndex(0)
10>Emitted(5, 30) Source(3, 30) + SourceIndex(0)
11>Emitted(5, 31) Source(3, 31) + SourceIndex(0)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(6, 1) Source(4, 1) + SourceIndex(0)
2 >Emitted(6, 2) Source(4, 2) + SourceIndex(0)
---
>>>exports.getSecondsInDay = getSecondsInDay;
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 > ^^->
1->
2 >export function getSecondsInDay() {
> return c.multiply(10, 15);
>}
1->Emitted(7, 1) Source(2, 1) + SourceIndex(0)
2 >Emitted(7, 43) Source(4, 2) + SourceIndex(0)
---
>>>var mod = require("../core/anotherModule");
1->
2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1->
>
2 >import * as mod from '../core/anotherModule';
1->Emitted(8, 1) Source(5, 1) + SourceIndex(0)
2 >Emitted(8, 44) Source(5, 46) + SourceIndex(0)
---
>>>exports.m = mod;
1 >
2 >^^^^^^^^
3 > ^
4 > ^^^
5 > ^^^
6 > ^
7 > ^^^^^^^^^^^^^^^^->
1 >
>export const
2 >
3 > m
4 > =
5 > mod
6 > ;
1 >Emitted(9, 1) Source(6, 14) + SourceIndex(0)
2 >Emitted(9, 9) Source(6, 14) + SourceIndex(0)
3 >Emitted(9, 10) Source(6, 15) + SourceIndex(0)
4 >Emitted(9, 13) Source(6, 18) + SourceIndex(0)
5 >Emitted(9, 16) Source(6, 21) + SourceIndex(0)
6 >Emitted(9, 17) Source(6, 22) + SourceIndex(0)
---
>>>//# sourceMappingURL=index.js.map
//// [/src/tests/index.d.ts]
import * as mod from '../core/anotherModule';
export declare const m: typeof mod;
//// [/src/tests/index.js]
"use strict";
exports.__esModule = true;
var c = require("../core/index");
var logic = require("../logic/index");
c.leftPad("", 10);
logic.getSecondsInDay();
var mod = require("../core/anotherModule");
exports.m = mod;