Skip to content

Commit

Permalink
test(ngcc): load standard files only once (#38840)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JoostK authored and AndrewKushnir committed Sep 15, 2020
1 parent ea36466 commit e4c12c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/compiler-cli/ngcc/test/integration/util.ts
Expand Up @@ -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);

Expand Down

0 comments on commit e4c12c8

Please sign in to comment.