MCPcopy
hub / github.com/angular/angular / test

Function test

integration/terser/test.js:6–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4const Terser = require('terser');
5
6async function test() {
7 const outputPath = resolve(__dirname, './core.min.js');
8 const pathToCoreFesm2020 = resolve(__dirname, './node_modules/@angular/core/fesm2022/core.mjs');
9 const coreFesm2022Content = readFileSync(pathToCoreFesm2020, 'utf8');
10
11 const GLOBAL_DEFS_FOR_TERSER = (await import('@angular/compiler-cli')).GLOBAL_DEFS_FOR_TERSER;
12
13 // Ensure that Terser global_defs exported by compiler-cli work.
14 const terserOpts = {
15 compress: {
16 module: true,
17 global_defs: GLOBAL_DEFS_FOR_TERSER,
18 },
19 };
20 const result = await Terser.minify(coreFesm2022Content, terserOpts);
21 writeFileSync(outputPath, result.code);
22
23 for (const def of Object.keys(GLOBAL_DEFS_FOR_TERSER)) {
24 if (result.code.includes(def)) {
25 throw (
26 `'${def}' should have been removed from core bundle, but was still there.\n` +
27 `See output at ${outputPath}.`
28 );
29 }
30 }
31
32 console.info('Output looks good.');
33}
34
35test().catch((e) => {
36 console.error(e);

Callers 1

test.jsFile · 0.70

Calls 3

keysMethod · 0.65
infoMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…