test: add integration test for lazy chunks and ngDevMode in cli apps (#32957)

PR Close #32957
This commit is contained in:
Filipe Silva
2019-10-02 13:09:42 +01:00
committed by Matias Niemelä
parent abd2a58c67
commit 609d2557bc
40 changed files with 21689 additions and 0 deletions

View File

@ -0,0 +1,15 @@
const fs = require('fs');
const path = require('path');
const distPath = './dist/';
const ngDevModeVariable = 'ngDevMode';
const filesWithNgDevMode = fs.readdirSync(distPath)
.filter(p => p.endsWith('.js'))
.filter(p => fs.readFileSync(path.join(distPath, p), 'utf-8').includes(ngDevModeVariable));
if (filesWithNgDevMode.length > 0) {
throw new Error(`Found '${ngDevModeVariable}' referenced in ${filesWithNgDevMode}. These references should be tree-shaken away!`);
} else {
console.log(`No '${ngDevModeVariable}' references found in ${distPath}`)
}