Complicate the paths of the project for better sourcemap testing

This commit is contained in:
Ryan Cavanaugh 2018-06-05 14:06:13 -07:00
parent 394e29f9d1
commit e40778070e
8 changed files with 94 additions and 14 deletions

View File

@ -239,13 +239,23 @@ namespace ts {
builder.buildAllProjects();
assertDiagnosticMessages(/*none*/);
it("Generates files matching the baseline", () => {
Harness.Baseline.runBaseline("outfile-concat.js", () => {
return fs.readFileSync("/src/third/third-output.js", 'utf-8');
const files = [
"/src/third/thirdjs/output/third-output.js",
"/src/third/thirdjs/output/third-output.js.map"
];
for (const file of files) {
it(`Generates files matching the baseline - ${file}`, () => {
Harness.Baseline.runBaseline(getBaseFileName(file), () => {
return fs.readFileSync(file, 'utf-8');
});
});
Harness.Baseline.runBaseline("outfile-concat.js.map", () => {
return fs.readFileSync("/src/third/third-output.js.map", 'utf-8');
}
it(`Generates files matching the baseline - file listing for outFile-concat`, () => {
Harness.Baseline.runBaseline("outfile-concat-fileListing.txt", () => {
return fs.getFileListing();
});
});
});

View File

@ -353,10 +353,7 @@ namespace vfs {
if (!result.node) this._mkdir(result);
}
/**
* Print diagnostic information about the structure of the file system to the console.
*/
public debugPrint(): void {
public getFileListing(): string {
let result = "";
const printLinks = (dirname: string | undefined, links: collections.SortedMap<string, Inode>) => {
const iterator = collections.getIterator(links);
@ -384,7 +381,14 @@ namespace vfs {
}
};
printLinks(/*dirname*/ undefined, this._getRootLinks());
console.log(result);
return result;
}
/**
* Print diagnostic information about the structure of the file system to the console.
*/
public debugPrint(): void {
console.log(this.getFileListing());
}
// POSIX API (aligns with NodeJS "fs" module API)

View File

@ -0,0 +1,39 @@
*/
/lib/
/lib/lib.d.ts
/src/
/src/2/
/src/2/second-output.d.ts
/src/2/second-output.d.ts.map
/src/2/second-output.js
/src/2/second-output.js.map
/src/first/
/src/first/bin/
/src/first/bin/first-output.d.ts
/src/first/bin/first-output.d.ts.map
/src/first/bin/first-output.js
/src/first/bin/first-output.js.map
/src/first/first_part1.ts
/src/first/first_part2.ts
/src/first/first_part3.ts
/src/first/tsconfig.json
/src/first_part1.ts
/src/first_part2.ts
/src/first_part3.ts
/src/second/
/src/second/second_part1.ts
/src/second/second_part2.ts
/src/second/tsconfig.json
/src/second_part1.ts
/src/second_part2.ts
/src/third/
/src/third/third_part1.ts
/src/third/thirdjs/
/src/third/thirdjs/output/
/src/third/thirdjs/output/third-output.d.ts
/src/third/thirdjs/output/third-output.d.ts.map
/src/third/thirdjs/output/third-output.js
/src/third/thirdjs/output/third-output.js.map
/src/third/tsconfig.json
/src/third_part1.ts
/src/tsconfig.json

View File

@ -0,0 +1,26 @@
var s = "Hello, world";
console.log(s);
console.log(f());
function f() {
return "JS does hoists";
}
//# sourceMappingURL=first-output.js.map
var N;
(function (N) {
function f() {
console.log('testing');
}
f();
})(N || (N = {}));
var C = (function () {
function C() {
}
C.prototype.doSomething = function () {
console.log("something got done");
};
return C;
}());
//# sourceMappingURL=second-output.js.map
var c = new C();
c.doSomething();
//# sourceMappingURL=third-output.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"third-output.js","sections":[{"offset":{"line":0,"column":0},"map":{"version":3,"file":"first-output.js","sourceRoot":"","sources":["../first_part1.ts","../first_part2.ts","../first_part3.ts"],"names":[],"mappings":"AAIA,IAAM,CAAC,GAAG,cAAc,CAAC;AAMzB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;ACVf,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;ACAjB;IACI,OAAO,gBAAgB,CAAC;AAC5B,CAAC"}},{"offset":{"line":7,"column":0},"map":{"version":3,"file":"second-output.js","sourceRoot":"","sources":["../second/second_part1.ts","../second/second_part2.ts"],"names":[],"mappings":"AAIA,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;IACP;QACI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,CAAC,EAAE,CAAC;AACR,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;ACVD;IAAA;IAIA,CAAC;IAHG,uBAAW,GAAX;QACI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC;IACL,QAAC;AAAD,CAAC,AAJD,IAIC"}},{"offset":{"line":22,"column":41},"map":{"version":3,"file":"third-output.js","sourceRoot":"","sources":["../../third_part1.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;AAChB,CAAC,CAAC,WAAW,EAAE,CAAC"}}]}

View File

@ -7,7 +7,7 @@
"sourceMap": true,
"declarationMap": true,
"declaration": true,
"outFile": "./first-output.js"
"outFile": "./bin/first-output.js"
},
"references": [
]

View File

@ -7,7 +7,7 @@
"sourceMap": true,
"declarationMap": true,
"declaration": true,
"outFile": "./second-output.js"
"outFile": "../2/second-output.js"
},
"references": [
]

View File

@ -7,7 +7,7 @@
"sourceMap": true,
"declarationMap": true,
"declaration": true,
"outFile": "./third-output.js"
"outFile": "./thirdjs/output/third-output.js"
},
"references": [
{ "path": "../first", "prepend": true },