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)