|
1 | 1 | 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 |
| - |
10 | 2 | 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!; |
25 | 9 | });
|
26 | 10 |
|
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 | + }); |
35 | 17 |
|
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"], |
38 | 23 | });
|
39 | 24 | });
|
40 | 25 | }
|
0 commit comments