Skip to content

Commit d9ad559

Browse files
committed
Verify demo build
1 parent 85b8d27 commit d9ad559

31 files changed

+243
-60
lines changed

src/harness/virtualFileSystemWithWatch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Number { toExponential: any; }
1111
interface Object {}
1212
interface RegExp {}
1313
interface String { charAt: any; }
14-
interface Array<T> {}`
14+
interface Array<T> { length: number; [n: number]: T; }`
1515
};
1616

1717
export const safeList = {

src/testRunner/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"unittests/services/transpile.ts",
9494
"unittests/tsbuild/amdModulesWithOut.ts",
9595
"unittests/tsbuild/containerOnlyReferenced.ts",
96+
"unittests/tsbuild/demo.ts",
9697
"unittests/tsbuild/emptyFiles.ts",
9798
"unittests/tsbuild/graphOrdering.ts",
9899
"unittests/tsbuild/inferredTypeFromTransitiveModule.ts",
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
namespace ts {
2+
describe("unittests:: tsbuild:: on demo project", () => {
3+
let projFs: vfs.FileSystem;
4+
const { time } = getTime();
5+
6+
before(() => {
7+
projFs = loadProjectFromDisk("tests/projects/demo", time);
8+
});
9+
10+
after(() => {
11+
projFs = undefined!; // Release the contents
12+
});
13+
14+
function coreOutputs(): string[] {
15+
return [
16+
"/src/lib/core/utilities.js",
17+
"/src/lib/core/utilities.d.ts",
18+
"/src/lib/core/tsconfig.tsbuildinfo"
19+
];
20+
}
21+
22+
function animalOutputs(): string[] {
23+
return [
24+
"/src/lib/animals/animal.js",
25+
"/src/lib/animals/animal.d.ts",
26+
"/src/lib/animals/index.js",
27+
"/src/lib/animals/index.d.ts",
28+
"/src/lib/animals/dog.js",
29+
"/src/lib/animals/dog.d.ts",
30+
"/src/lib/animals/tsconfig.tsbuildinfo"
31+
];
32+
}
33+
34+
function zooOutputs(): string[] {
35+
return [
36+
"/src/lib/zoo/zoo.js",
37+
"/src/lib/zoo/zoo.d.ts",
38+
"/src/lib/zoo/tsconfig.tsbuildinfo"
39+
];
40+
}
41+
42+
interface VerifyBuild {
43+
modifyDiskLayout: (fs: vfs.FileSystem) => void;
44+
expectedExitStatus: ExitStatus;
45+
expectedDiagnostics: fakes.ExpectedDiagnostic[];
46+
expectedOutputs: readonly string[];
47+
notExpectedOutputs: readonly string[];
48+
}
49+
50+
function verifyBuild({ modifyDiskLayout, expectedExitStatus, expectedDiagnostics, expectedOutputs, notExpectedOutputs }: VerifyBuild) {
51+
const fs = projFs.shadow();
52+
const host = new fakes.SolutionBuilderHost(fs);
53+
modifyDiskLayout(fs);
54+
const builder = createSolutionBuilder(host, ["/src/tsconfig.json"], { verbose: true });
55+
const exitStatus = builder.build();
56+
assert.equal(exitStatus, expectedExitStatus);
57+
host.assertDiagnosticMessages(...expectedDiagnostics);
58+
verifyOutputsPresent(fs, expectedOutputs);
59+
verifyOutputsAbsent(fs, notExpectedOutputs);
60+
}
61+
62+
it("in master branch with everything setup correctly, reports no error", () => {
63+
verifyBuild({
64+
modifyDiskLayout: noop,
65+
expectedExitStatus: ExitStatus.Success,
66+
expectedDiagnostics: [
67+
getExpectedDiagnosticForProjectsInBuild("src/core/tsconfig.json", "src/animals/tsconfig.json", "src/zoo/tsconfig.json", "src/tsconfig.json"),
68+
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/core/tsconfig.json", "src/lib/core/utilities.js"],
69+
[Diagnostics.Building_project_0, "/src/core/tsconfig.json"],
70+
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/animals/tsconfig.json", "src/lib/animals/animal.js"],
71+
[Diagnostics.Building_project_0, "/src/animals/tsconfig.json"],
72+
[Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/zoo/tsconfig.json", "src/lib/zoo/zoo.js"],
73+
[Diagnostics.Building_project_0, "/src/zoo/tsconfig.json"]
74+
],
75+
expectedOutputs: [...coreOutputs(), ...animalOutputs(), ...zooOutputs()],
76+
notExpectedOutputs: emptyArray
77+
});
78+
});
79+
});
80+
}

tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/incremental-declaration-changes/inferred-type-from-transitive-module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export declare const lazyBar: LazyAction<() => void, typeof import("./lazyIndex"
3131
"program": {
3232
"fileInfos": {
3333
"../../lib/lib.d.ts": {
34-
"version": "-15964756381",
35-
"signature": "-15964756381"
34+
"version": "3858781397",
35+
"signature": "3858781397"
3636
},
3737
"../bar.ts": {
3838
"version": "747071916",

tests/baselines/reference/tsbuild/inferredTypeFromTransitiveModule/initial-Build/inferred-type-from-transitive-module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ exports.bar = bar_1.default;
6969
"program": {
7070
"fileInfos": {
7171
"../../lib/lib.d.ts": {
72-
"version": "-15964756381",
73-
"signature": "-15964756381"
72+
"version": "3858781397",
73+
"signature": "3858781397"
7474
},
7575
"../bar.ts": {
7676
"version": "5936740878",

tests/baselines/reference/tsbuild/lateBoundSymbol/incremental-declaration-doesnt-change/interface-is-merged-and-contains-late-bound-member.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ type A = HKT<number>[typeof sym];
2222
"program": {
2323
"fileInfos": {
2424
"../lib/lib.d.ts": {
25-
"version": "-15964756381",
26-
"signature": "-15964756381"
25+
"version": "3858781397",
26+
"signature": "3858781397"
2727
},
2828
"./src/globals.d.ts": {
2929
"version": "-1994196675",

tests/baselines/reference/tsbuild/lateBoundSymbol/initial-Build/interface-is-merged-and-contains-late-bound-member.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ var x = 10;
1515
"program": {
1616
"fileInfos": {
1717
"../lib/lib.d.ts": {
18-
"version": "-15964756381",
19-
"signature": "-15964756381"
18+
"version": "3858781397",
19+
"signature": "3858781397"
2020
},
2121
"./src/globals.d.ts": {
2222
"version": "-1994196675",

tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/sample.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ export class someClass { }
172172
"program": {
173173
"fileInfos": {
174174
"../../lib/lib.d.ts": {
175-
"version": "-15964756381",
176-
"signature": "-15964756381"
175+
"version": "3858781397",
176+
"signature": "3858781397"
177177
},
178178
"./anothermodule.ts": {
179179
"version": "-2676574883",
@@ -212,8 +212,8 @@ export class someClass { }
212212
"program": {
213213
"fileInfos": {
214214
"../../lib/lib.d.ts": {
215-
"version": "-15964756381",
216-
"signature": "-15964756381"
215+
"version": "3858781397",
216+
"signature": "3858781397"
217217
},
218218
"../core/index.ts": {
219219
"version": "-2069755619",
@@ -262,8 +262,8 @@ export class someClass { }
262262
"program": {
263263
"fileInfos": {
264264
"../../lib/lib.d.ts": {
265-
"version": "-15964756381",
266-
"signature": "-15964756381"
265+
"version": "3858781397",
266+
"signature": "3858781397"
267267
},
268268
"../core/index.ts": {
269269
"version": "-2069755619",

tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-declaration-option-changes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export declare function multiply(a: number, b: number): number;
2121
"program": {
2222
"fileInfos": {
2323
"../../lib/lib.d.ts": {
24-
"version": "-15964756381",
25-
"signature": "-15964756381"
24+
"version": "3858781397",
25+
"signature": "3858781397"
2626
},
2727
"./anothermodule.ts": {
2828
"version": "-2676574883",

tests/baselines/reference/tsbuild/sample1/incremental-declaration-changes/when-esModuleInterop-option-changes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ exports.m = mod;
3737
"program": {
3838
"fileInfos": {
3939
"../../lib/lib.d.ts": {
40-
"version": "-15964756381",
41-
"signature": "-15964756381"
40+
"version": "3858781397",
41+
"signature": "3858781397"
4242
},
4343
"../core/index.ts": {
4444
"version": "-13851440507",

0 commit comments

Comments
 (0)