Skip to content

Commit b75b21f

Browse files
filipesilvahansl
authored andcommitted
test: re-enable disabled architect build tests
1 parent 38c8463 commit b75b21f

File tree

93 files changed

+186
-552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+186
-552
lines changed

packages/@angular/cli/utilities/build-webpack-compat.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const expectedWorkspace = {
101101
},
102102
'configurations': {
103103
'production': {
104+
'optimizationLevel': 1,
104105
'outputHashing': 'all',
105106
'sourceMap': false,
106107
'extractCss': true,
@@ -182,6 +183,7 @@ const expectedWorkspace = {
182183
},
183184
'configurations': {
184185
'production': {
186+
'optimizationLevel': 1,
185187
'outputHashing': 'all',
186188
'sourceMap': false,
187189
'extractCss': true,

packages/@angular/cli/utilities/build-webpack-compat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export function createArchitectWorkspace(cliConfig: any): any {
4343
options: browserOptions,
4444
configurations: {
4545
production: {
46+
optimizationLevel: 1,
4647
outputHashing: 'all',
4748
sourceMap: false,
4849
extractCss: true,

tests/e2e/tests/build/allow-js.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { updateTsConfig } from '../../utils/project';
33
import { appendToFile, writeFile } from '../../utils/fs';
44

55
export default async function() {
6-
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
7-
return;
6+
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
87

98
await writeFile('src/my-js-file.js', 'console.log(1); export const a = 2;');
109
await appendToFile('src/main.ts', `

tests/e2e/tests/build/aot/aot-decorators.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ import {expectToFail} from '../../../utils/utils';
44
import {ngVersionMatches} from '../../../utils/version';
55

66
export default function() {
7-
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
7+
// TODO(architect): This behaviour seems to have changed in devkit/build-webpack. Figure out why.
88
return;
99

10-
if (!ngVersionMatches('^4.0.0')) {
11-
return Promise.resolve();
12-
}
13-
1410
return ng('generate', 'component', 'test-component', '--module', 'app.module.ts')
1511
.then(() => prependToFile('src/app/test-component/test-component.component.ts', `
1612
import { Optional, SkipSelf } from '@angular/core';

tests/e2e/tests/build/aot/aot-i18n.ts

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import {ng} from '../../../utils/process';
2-
import {expectFileToMatch, writeFile, createDir, appendToFile, readFile} from '../../../utils/fs';
3-
import {expectToFail} from '../../../utils/utils';
4-
import {Version} from '../../../../../packages/@angular/cli/upgrade/version';
5-
import {SemVer} from 'semver';
1+
import { ng } from '../../../utils/process';
2+
import { expectFileToMatch, writeFile, createDir, appendToFile, readFile } from '../../../utils/fs';
3+
import { expectToFail } from '../../../utils/utils';
4+
import { Version } from '../../../../../packages/@angular/cli/upgrade/version';
5+
import { SemVer } from 'semver';
66

7-
export default function() {
8-
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
9-
return;
7+
export default function () {
8+
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
109

1110
return Promise.resolve()
1211
.then(() => createDir('src/locale'))
@@ -25,37 +24,17 @@ export default function() {
2524
</xliff>`))
2625
.then(() => appendToFile('src/app/app.component.html',
2726
'<h1 i18n="An introduction header for this sample">Hello i18n!</h1>'))
28-
.then(() => ng('build', '--aot', '--i18n-file', 'src/locale/messages.fr.xlf', '--i18n-format',
27+
.then(() => ng('build', '--aot', '--i18n-file', 'locale/messages.fr.xlf', '--i18n-format',
2928
'xlf', '--i18n-locale', 'fr'))
3029
.then(() => expectFileToMatch('dist/main.js', /Bonjour i18n!/))
3130
.then(() => ng('build', '--aot'))
3231
.then(() => expectToFail(() => expectFileToMatch('dist/main.js', /Bonjour i18n!/)))
3332
.then(() => expectFileToMatch('dist/main.js', /Hello i18n!/))
3433
.then(() => appendToFile('src/app/app.component.html',
3534
'<p i18n>Other content</p>'))
36-
.then(() => readFile('node_modules/@angular/compiler-cli/package.json')
37-
.then((compilerCliPackage): any => {
38-
const version = new Version(JSON.parse(compilerCliPackage).version);
39-
if (version.major === 2) {
40-
return expectToFail(() => ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf',
41-
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'ignore'));
42-
} else {
43-
return ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf', '--i18nFormat',
44-
'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'ignore')
45-
.then(() => expectFileToMatch('dist/main.js', /Other content/));
46-
}
47-
})
48-
)
49-
.then(() => readFile('node_modules/@angular/compiler-cli/package.json')
50-
.then((compilerCliPackage): any => {
51-
const version = new Version(JSON.parse(compilerCliPackage).version);
52-
if (version.isGreaterThanOrEqualTo(new SemVer('4.2.0-beta.0')) || version.major === 2) {
53-
return expectToFail(() => ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf',
54-
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'error'));
55-
} else {
56-
return ng('build', '--aot', '--i18nFile', 'src/locale/messages.fr.xlf',
57-
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'error');
58-
}
59-
})
60-
);
35+
.then(() => ng('build', '--aot', '--i18nFile', 'locale/messages.fr.xlf', '--i18nFormat',
36+
'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'ignore'))
37+
.then(() => expectFileToMatch('dist/main.js', /Other content/))
38+
.then(() => expectToFail(() => ng('build', '--aot', '--i18nFile', 'locale/messages.fr.xlf',
39+
'--i18nFormat', 'xlf', '--i18n-locale', 'fr', '--i18n-missing-translation', 'error')));
6140
}

tests/e2e/tests/build/aot/aot-rebuild.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

tests/e2e/tests/build/aot/exclude.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/e2e/tests/build/base-href.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
import { ng } from '../../utils/process';
2-
import { expectFileToMatch, replaceInFile } from '../../utils/fs';
3-
import { updateJsonFile } from '../../utils/project';
2+
import { expectFileToMatch } from '../../utils/fs';
43

54

65
export default function() {
7-
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
8-
return;
6+
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
97

108
return ng('build', '--base-href', '/myUrl')
11-
.then(() => expectFileToMatch('dist/index.html', /<base href="\/myUrl">/))
12-
.then(() => updateJsonFile('.angular-cli.json', configJson => {
13-
const app = configJson['apps'][0];
14-
app['baseHref'] = '/myUrl';
15-
}))
16-
.then(() => ng('build'))
17-
.then(() => expectFileToMatch('dist/index.html', /<base href="\/myUrl">/))
18-
.then(() => replaceInFile('src/index.html', 'href="/"', 'href=""'))
19-
.then(() => ng('build'))
209
.then(() => expectFileToMatch('dist/index.html', /<base href="\/myUrl">/));
2110
}

tests/e2e/tests/build/build-errors.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const extraErrors = [
1212
];
1313

1414
export default function () {
15-
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
16-
return;
15+
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
1716

1817
if (process.platform.startsWith('win')) {
1918
return Promise.resolve();

tests/e2e/tests/build/build-optimizer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import { expectToFail } from '../../utils/utils';
44

55

66
export default function () {
7-
// TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
8-
return;
7+
// TODO(architect): Delete this test. It is now in devkit/build-webpack.
98

109
return ng('build', '--aot', '--build-optimizer')
1110
.then(() => expectToFail(() => expectFileToMatch('dist/main.js', /\.decorators =/)))
12-
.then(() => ng('build', '--optimization-level', '1'))
11+
.then(() => ng('build', '--prod'))
1312
.then(() => expectToFail(() => expectFileToExist('dist/vendor.js')))
1413
.then(() => expectToFail(() => expectFileToMatch('dist/main.js', /\.decorators =/)));
1514
}

0 commit comments

Comments
 (0)