forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweird.ts
More file actions
33 lines (29 loc) · 1.51 KB
/
weird.ts
File metadata and controls
33 lines (29 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {normalize} from 'path';
import {createProjectFromAsset} from '../../../utils/assets';
import {exec} from '../../../utils/process';
import {updateJsonFile} from '../../../utils/project';
import {expectFileSizeToBeUnder, expectFileToExist} from '../../../utils/fs';
import {expectToFail} from '../../../utils/utils';
export default function(skipCleaning: () => void) {
return Promise.resolve()
.then(() => createProjectFromAsset('webpack/test-app-weird'))
.then(() => exec(normalize('node_modules/.bin/webpack'), '-p'))
.then(() => expectFileToExist('dist/app.main.js'))
.then(() => expectFileToExist('dist/0.app.main.js'))
.then(() => expectFileToExist('dist/1.app.main.js'))
.then(() => expectFileToExist('dist/2.app.main.js'))
.then(() => expectFileSizeToBeUnder('dist/app.main.js', 410000))
.then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 40000))
// Skip code generation and rebuild.
.then(() => updateJsonFile('aotplugin.config.json', json => {
json['skipCodeGeneration'] = true;
}))
.then(() => exec(normalize('node_modules/.bin/webpack'), '-p'))
.then(() => expectFileToExist('dist/app.main.js'))
.then(() => expectFileToExist('dist/0.app.main.js'))
.then(() => expectFileToExist('dist/1.app.main.js'))
.then(() => expectFileToExist('dist/2.app.main.js'))
.then(() => expectToFail(() => expectFileSizeToBeUnder('dist/app.main.js', 410000)))
.then(() => expectFileSizeToBeUnder('dist/0.app.main.js', 40000))
.then(() => skipCleaning());
}