Skip to content

Commit 7c0cc4a

Browse files
committed
empty files to baseline test
1 parent c2eabdd commit 7c0cc4a

File tree

3 files changed

+72
-32
lines changed

3 files changed

+72
-32
lines changed
Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,25 @@
11
namespace ts {
2-
const projFs = loadProjectFromDisk("tests/projects/empty-files");
3-
4-
const allExpectedOutputs = [
5-
"/src/core/index.js",
6-
"/src/core/index.d.ts",
7-
"/src/core/index.d.ts.map",
8-
];
9-
102
describe("unittests:: tsbuild - empty files option in tsconfig", () => {
11-
it("has empty files diagnostic when files is empty and no references are provided", () => {
12-
const fs = projFs.shadow();
13-
const host = fakes.SolutionBuilderHost.create(fs);
14-
const builder = createSolutionBuilder(host, ["/src/no-references"], { dry: false, force: false, verbose: false });
15-
16-
host.clearDiagnostics();
17-
builder.build();
18-
host.assertDiagnosticMessages({
19-
message: [Diagnostics.The_files_list_in_config_file_0_is_empty, "/src/no-references/tsconfig.json"],
20-
location: expectedLocationLastIndexOf(fs, "/src/no-references/tsconfig.json", "[]"),
21-
});
22-
23-
// Check for outputs to not be written.
24-
verifyOutputsAbsent(fs, allExpectedOutputs);
3+
let projFs: vfs.FileSystem;
4+
before(() => {
5+
projFs = loadProjectFromDisk("tests/projects/empty-files");
6+
});
7+
after(() => {
8+
projFs = undefined!;
259
});
2610

27-
it("does not have empty files diagnostic when files is empty and references are provided", () => {
28-
const fs = projFs.shadow();
29-
const host = fakes.SolutionBuilderHost.create(fs);
30-
const builder = createSolutionBuilder(host, ["/src/with-references"], { dry: false, force: false, verbose: false });
31-
32-
host.clearDiagnostics();
33-
builder.build();
34-
host.assertDiagnosticMessages(/*empty*/);
11+
verifyTsc({
12+
scenario: "emptyFiles",
13+
subScenario: "does not have empty files diagnostic when files is empty and references are provided",
14+
fs: () => projFs,
15+
commandLineArgs: ["--b", "/src/no-references"],
16+
});
3517

36-
// Check for outputs to be written.
37-
verifyOutputsPresent(fs, allExpectedOutputs);
18+
verifyTsc({
19+
scenario: "emptyFiles",
20+
subScenario: "has empty files diagnostic when files is empty and no references are provided",
21+
fs: () => projFs,
22+
commandLineArgs: ["--b", "/src/with-references"],
3823
});
3924
});
4025
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//// [/lib/initial-buildOutput.txt]
2+
/lib/tsc --b /src/no-references
3+
src/no-references/tsconfig.json(3,14): error TS18002: The 'files' list in config file '/src/no-references/tsconfig.json' is empty.
4+
exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped
5+
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//// [/lib/initial-buildOutput.txt]
2+
/lib/tsc --b /src/with-references
3+
exitCode:: ExitStatus.Success
4+
5+
6+
//// [/src/core/index.d.ts]
7+
export declare function multiply(a: number, b: number): number;
8+
//# sourceMappingURL=index.d.ts.map
9+
10+
//// [/src/core/index.d.ts.map]
11+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,UAAmB"}
12+
13+
//// [/src/core/index.js]
14+
"use strict";
15+
exports.__esModule = true;
16+
function multiply(a, b) { return a * b; }
17+
exports.multiply = multiply;
18+
19+
20+
//// [/src/core/tsconfig.tsbuildinfo]
21+
{
22+
"program": {
23+
"fileInfos": {
24+
"../../lib/lib.d.ts": {
25+
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
26+
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };"
27+
},
28+
"./index.ts": {
29+
"version": "5112841898-export function multiply(a: number, b: number) { return a * b; }\r\n",
30+
"signature": "3361149553-export declare function multiply(a: number, b: number): number;\r\n//# sourceMappingURL=index.d.ts.map"
31+
}
32+
},
33+
"options": {
34+
"composite": true,
35+
"declaration": true,
36+
"declarationMap": true,
37+
"skipDefaultLibCheck": true,
38+
"configFilePath": "./tsconfig.json"
39+
},
40+
"referencedMap": {},
41+
"exportedModulesMap": {},
42+
"semanticDiagnosticsPerFile": [
43+
"../../lib/lib.d.ts",
44+
"./index.ts"
45+
]
46+
},
47+
"version": "FakeTSVersion"
48+
}
49+

0 commit comments

Comments
 (0)