test(ngcc): load standard files only once (#38840)

In the integration test suite of ngcc, we load a set of files from
`node_modules` into memory. This includes the `typescript` package and
`@angular` scoped packages, which account for a large number of large
files that needs to be loaded from disk. This commit moves this work
to the top-level, such that it doesn't have to be repeated in all tests.

PR Close #38840
This commit is contained in:
JoostK 2020-09-14 14:22:34 +02:00 committed by Andrew Kushnir
parent fd44d84a33
commit a1c1c450dc
1 changed files with 3 additions and 1 deletions

View File

@ -213,13 +213,15 @@ export function compileIntoApf(
fs.resolve(`/node_modules/${pkgName}/package.json`), JSON.stringify(pkgJson, null, 2));
}
const stdFiles = loadStandardTestFiles({fakeCore: false});
/**
* Prepares a mock filesystem that contains all provided source files, which can be used to emit
* compiled code into.
*/
function setupCompileFs(sources: PackageSources): {rootNames: string[], compileFs: FileSystem} {
const compileFs = new MockFileSystemPosix(true);
compileFs.init(loadStandardTestFiles({fakeCore: false}));
compileFs.init(stdFiles);
const rootNames = Object.keys(sources);