Skip to content

Commit e407780

Browse files
committed
Complicate the paths of the project for better sourcemap testing
1 parent 394e29f commit e407780

8 files changed

Lines changed: 94 additions & 14 deletions

File tree

src/harness/unittests/tsbuild.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,23 @@ namespace ts {
239239
builder.buildAllProjects();
240240
assertDiagnosticMessages(/*none*/);
241241

242-
it("Generates files matching the baseline", () => {
243-
Harness.Baseline.runBaseline("outfile-concat.js", () => {
244-
return fs.readFileSync("/src/third/third-output.js", 'utf-8');
242+
const files = [
243+
"/src/third/thirdjs/output/third-output.js",
244+
"/src/third/thirdjs/output/third-output.js.map"
245+
];
246+
247+
248+
for (const file of files) {
249+
it(`Generates files matching the baseline - ${file}`, () => {
250+
Harness.Baseline.runBaseline(getBaseFileName(file), () => {
251+
return fs.readFileSync(file, 'utf-8');
252+
});
245253
});
246-
247-
Harness.Baseline.runBaseline("outfile-concat.js.map", () => {
248-
return fs.readFileSync("/src/third/third-output.js.map", 'utf-8');
254+
}
255+
256+
it(`Generates files matching the baseline - file listing for outFile-concat`, () => {
257+
Harness.Baseline.runBaseline("outfile-concat-fileListing.txt", () => {
258+
return fs.getFileListing();
249259
});
250260
});
251261
});

src/harness/vfs.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,7 @@ namespace vfs {
353353
if (!result.node) this._mkdir(result);
354354
}
355355

356-
/**
357-
* Print diagnostic information about the structure of the file system to the console.
358-
*/
359-
public debugPrint(): void {
356+
public getFileListing(): string {
360357
let result = "";
361358
const printLinks = (dirname: string | undefined, links: collections.SortedMap<string, Inode>) => {
362359
const iterator = collections.getIterator(links);
@@ -384,7 +381,14 @@ namespace vfs {
384381
}
385382
};
386383
printLinks(/*dirname*/ undefined, this._getRootLinks());
387-
console.log(result);
384+
return result;
385+
}
386+
387+
/**
388+
* Print diagnostic information about the structure of the file system to the console.
389+
*/
390+
public debugPrint(): void {
391+
console.log(this.getFileListing());
388392
}
389393

390394
// POSIX API (aligns with NodeJS "fs" module API)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
*/
2+
/lib/
3+
/lib/lib.d.ts
4+
/src/
5+
/src/2/
6+
/src/2/second-output.d.ts
7+
/src/2/second-output.d.ts.map
8+
/src/2/second-output.js
9+
/src/2/second-output.js.map
10+
/src/first/
11+
/src/first/bin/
12+
/src/first/bin/first-output.d.ts
13+
/src/first/bin/first-output.d.ts.map
14+
/src/first/bin/first-output.js
15+
/src/first/bin/first-output.js.map
16+
/src/first/first_part1.ts
17+
/src/first/first_part2.ts
18+
/src/first/first_part3.ts
19+
/src/first/tsconfig.json
20+
/src/first_part1.ts
21+
/src/first_part2.ts
22+
/src/first_part3.ts
23+
/src/second/
24+
/src/second/second_part1.ts
25+
/src/second/second_part2.ts
26+
/src/second/tsconfig.json
27+
/src/second_part1.ts
28+
/src/second_part2.ts
29+
/src/third/
30+
/src/third/third_part1.ts
31+
/src/third/thirdjs/
32+
/src/third/thirdjs/output/
33+
/src/third/thirdjs/output/third-output.d.ts
34+
/src/third/thirdjs/output/third-output.d.ts.map
35+
/src/third/thirdjs/output/third-output.js
36+
/src/third/thirdjs/output/third-output.js.map
37+
/src/third/tsconfig.json
38+
/src/third_part1.ts
39+
/src/tsconfig.json

tests/baselines/reference/third-output.js

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/baselines/reference/third-output.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/projects/outfile-concat/first/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"sourceMap": true,
88
"declarationMap": true,
99
"declaration": true,
10-
"outFile": "./first-output.js"
10+
"outFile": "./bin/first-output.js"
1111
},
1212
"references": [
1313
]

tests/projects/outfile-concat/second/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"sourceMap": true,
88
"declarationMap": true,
99
"declaration": true,
10-
"outFile": "./second-output.js"
10+
"outFile": "../2/second-output.js"
1111
},
1212
"references": [
1313
]

tests/projects/outfile-concat/third/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"sourceMap": true,
88
"declarationMap": true,
99
"declaration": true,
10-
"outFile": "./third-output.js"
10+
"outFile": "./thirdjs/output/third-output.js"
1111
},
1212
"references": [
1313
{ "path": "../first", "prepend": true },

0 commit comments

Comments
 (0)