From 87910189968637bb55cd8357bc852f3bbb2e1ade Mon Sep 17 00:00:00 2001 From: JoostK Date: Mon, 14 Sep 2020 14:22:34 +0200 Subject: [PATCH] test(ngcc): load standard files only once 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. --- packages/compiler-cli/ngcc/test/integration/util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/compiler-cli/ngcc/test/integration/util.ts b/packages/compiler-cli/ngcc/test/integration/util.ts index 53f272cb231b0..6f0439e69b80b 100644 --- a/packages/compiler-cli/ngcc/test/integration/util.ts +++ b/packages/compiler-cli/ngcc/test/integration/util.ts @@ -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);