mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Create tests when bundleInfo file is not present
This commit is contained in:
1 parent
9dabe69c84
commit
36ae7be415
15 files changed
+23966
-4
No files matched your search
@@ -1,5 +1,6 @@
|
||||
namespace ts {
|
||||
const infoExtension = ".tsbundleinfo";
|
||||
/*@internal*/
|
||||
export const infoExtension = ".tsbundleinfo";
|
||||
const brackets = createBracketsMap();
|
||||
const syntheticParent: TextRange = { pos: -1, end: -1 };
|
||||
|
||||
|
||||
@@ -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
+1827
File diff suppressed because it is too large.
Load diff
+3378
File diff suppressed because it is too large.
Load diff
+2410
File diff suppressed because it is too large.
Load diff
+1686
File diff suppressed because it is too large.
Load diff
+1578
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+1460
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
+1743
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user