Create tests when bundleInfo file is not present

This commit is contained in:
Sheetal Nandi
2019-01-29 15:13:26 -08:00
parent 9dabe69c84
commit 36ae7be415
15 changed files with 23966 additions and 4 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
namespace ts {
const infoExtension = ".tsbundleinfo";
/*@internal*/
export const infoExtension = ".tsbundleinfo";
const brackets = createBracketsMap();
const syntheticParent: TextRange = { pos: -1, end: -1 };
+18 -3
View File
@@ -489,8 +489,8 @@ export const b = new A();`);
]
];
function verifyOutFileScenario(scenario: string, modifyFs: (fs: vfs.FileSystem) => void | ReadonlyArray<string>) {
describe(`unittests:: tsbuild - outFile:: ${scenario}`, () => {
function verifyOutFileScenarioWorker(scenario: string, modifyFs: (fs: vfs.FileSystem) => void | ReadonlyArray<string>, withoutBundleInfo: boolean) {
describe(`unittests:: tsbuild - outFile:: ${scenario}${withoutBundleInfo ? " without bundleInfo" : ""}`, () => {
let fs: vfs.FileSystem | undefined;
const actualReadFileMap = createMap<number>();
let additionalSourceFiles: ReadonlyArray<string> | void;
@@ -506,8 +506,18 @@ export const b = new A();`);
if (path.startsWith("/src/")) {
actualReadFileMap.set(path, (actualReadFileMap.get(path) || 0) + 1);
}
if (withoutBundleInfo && fileExtensionIs(path, infoExtension)) {
return undefined;
}
return originalReadFile.call(host, path);
};
if (withoutBundleInfo) {
const originalWriteFile = host.writeFile;
host.writeFile = (fileName, content, writeByteOrder) => {
return !fileExtensionIs(fileName, infoExtension) &&
originalWriteFile.call(host, fileName, content, writeByteOrder);
};
}
builder.buildAllProjects();
host.assertDiagnosticMessages(/*none*/);
});
@@ -529,7 +539,7 @@ export const b = new A();`);
const patch = fs!.diff();
// tslint:disable-next-line:no-null-keyword
Harness.Baseline.runBaseline(`outFile-${scenario.split(" ").join("-")}.js`, patch ? vfs.formatPatch(patch) : null);
Harness.Baseline.runBaseline(`outFile-${scenario.split(" ").join("-")}${withoutBundleInfo ? "-no-bundleInfo" : ""}.js`, patch ? vfs.formatPatch(patch) : null);
});
it("verify readFile calls", () => {
const expected = [
@@ -563,6 +573,11 @@ export const b = new A();`);
});
}
function verifyOutFileScenario(scenario: string, modifyFs: (fs: vfs.FileSystem) => void | ReadonlyArray<string>) {
verifyOutFileScenarioWorker(scenario, modifyFs, /*withoutBundleInfo*/ false);
verifyOutFileScenarioWorker(scenario, modifyFs, /*withoutBundleInfo*/ true);
}
verifyOutFileScenario("baseline sectioned sourcemaps", noop);
it("unittests:: tsbuild - outFile:: downstream prepend projects always get rebuilt", () => {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff