Skip to content

Commit 15c36eb

Browse files
committed
test: use the targets property in legacy cli e2e
1 parent 63b2b11 commit 15c36eb

31 files changed

+39
-39
lines changed

tests/legacy-cli/e2e/tests/basic/assets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default function () {
9595
{ 'glob': 'output-asset.txt', 'output': 'output-folder' },
9696
{ 'glob': '**/*', 'input': 'node_modules/some-package/', 'output': 'package-folder' }
9797
];
98-
const appArchitect = workspaceJson.projects['test-project'].architect;
98+
const appArchitect = workspaceJson.projects['test-project'].targets;
9999
appArchitect.build.options.assets = assets;
100100
appArchitect.test.options.assets = assets;
101101
}))

tests/legacy-cli/e2e/tests/basic/scripts-array.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function () {
2929
})
3030
.then(() => appendToFile('src/main.ts', 'import \'./string-script.js\';'))
3131
.then(() => updateJsonFile('angular.json', configJson => {
32-
const appArchitect = configJson.projects['test-project'].architect;
32+
const appArchitect = configJson.projects['test-project'].targets;
3333
appArchitect.build.options.scripts = [
3434
{ input: 'src/string-script.js' },
3535
{ input: 'src/zstring-script.js' },

tests/legacy-cli/e2e/tests/basic/styles-array.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function () {
1717
'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }'
1818
})
1919
.then(() => updateJsonFile('angular.json', workspaceJson => {
20-
const appArchitect = workspaceJson.projects['test-project'].architect;
20+
const appArchitect = workspaceJson.projects['test-project'].targets;
2121
appArchitect.build.options.styles = [
2222
{ input: 'src/string-style.css' },
2323
{ input: 'src/input-style.css' },

tests/legacy-cli/e2e/tests/build/build-app-shell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function () {
2626

2727
return Promise.resolve()
2828
.then(() => updateJsonFile('angular.json', workspaceJson => {
29-
const appArchitect = workspaceJson.projects['test-project'].architect;
29+
const appArchitect = workspaceJson.projects['test-project'].targets;
3030
appArchitect['server'] = {
3131
builder: '@angular-devkit/build-angular:server',
3232
options: {

tests/legacy-cli/e2e/tests/build/bundle-budgets.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default function () {
3535
if (cfg.expectation === 'error') {
3636
return () => {
3737
return updateJsonFile('angular.json', (json) => {
38-
json.projects['test-project'].architect.build.options.budgets = [cfg.budget];
38+
json.projects['test-project'].targets.build.options.budgets = [cfg.budget];
3939
})
4040
.then(() => expectToFail(() => ng('build', '--optimization')))
4141
.then(errorMessage => {
@@ -47,7 +47,7 @@ export default function () {
4747
} else if (cfg.expectation === 'warning') {
4848
return () => {
4949
return updateJsonFile('angular.json', (json) => {
50-
json.projects['test-project'].architect.build.options.budgets = [cfg.budget];
50+
json.projects['test-project'].targets.build.options.budgets = [cfg.budget];
5151
})
5252
.then(() => ng('build', '--optimization'))
5353
.then(({ stdout }) => {
@@ -59,7 +59,7 @@ export default function () {
5959
} else { // pass
6060
return () => {
6161
return updateJsonFile('angular.json', (json) => {
62-
json.projects['test-project'].architect.build.options.budgets = [cfg.budget];
62+
json.projects['test-project'].targets.build.options.budgets = [cfg.budget];
6363
})
6464
.then(() => ng('build', '--optimization'))
6565
.then(({ stdout }) => {

tests/legacy-cli/e2e/tests/build/dynamic-import.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default async function() {
88
// Add a lazy module
99
await ng('generate', 'module', 'lazy');
1010
await updateJsonFile('angular.json', workspaceJson => {
11-
const appArchitect = workspaceJson.projects['test-project'].architect;
11+
const appArchitect = workspaceJson.projects['test-project'].targets;
1212
appArchitect.build.options.lazyModules = [
1313
'src/app/lazy/lazy.module'
1414
];

tests/legacy-cli/e2e/tests/build/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default function() {
77
// Try a prod build.
88
return Promise.resolve()
99
.then(() => updateJsonFile('angular.json', configJson => {
10-
const appArchitect = configJson.projects['test-project'].architect;
10+
const appArchitect = configJson.projects['test-project'].targets;
1111
appArchitect.build.configurations['prod-env'] = {
1212
fileReplacements: [
1313
{

tests/legacy-cli/e2e/tests/build/output-dir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function() {
1919
.then(() => expectFileToExist('./build-output/main.js'))
2020
.then(() => expectToFail(expectGitToBeClean))
2121
.then(() => updateJsonFile('angular.json', workspaceJson => {
22-
const appArchitect = workspaceJson.projects['test-project'].architect;
22+
const appArchitect = workspaceJson.projects['test-project'].targets;
2323
appArchitect.build.options.outputPath = 'config-build-output';
2424
}))
2525
.then(() => ng('build'))

tests/legacy-cli/e2e/tests/build/platform-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function () {
3636
dependencies['@angular/platform-server'] = platformServerVersion;
3737
}))
3838
.then(() => updateJsonFile('angular.json', workspaceJson => {
39-
const appArchitect = workspaceJson.projects['test-project'].architect;
39+
const appArchitect = workspaceJson.projects['test-project'].targets;
4040
appArchitect['server'] = {
4141
builder: '@angular-devkit/build-angular:server',
4242
options: {

tests/legacy-cli/e2e/tests/build/service-worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function() {
3232
// stuck to the first build done
3333
return silentNpm('remove', '@angular/service-worker')
3434
.then(() => silentNpm('install', '@angular/service-worker'))
35-
.then(() => ng('config', 'projects.test-project.architect.build.options.serviceWorker', 'true'))
35+
.then(() => ng('config', 'projects.test-project.targets.build.options.serviceWorker', 'true'))
3636
.then(() => writeFile('src/ngsw-config.json', JSON.stringify(MANIFEST, null, 2)))
3737
.then(() => ng('build', '--optimization'))
3838
.then(() => expectFileToExist(join(process.cwd(), 'dist')))

tests/legacy-cli/e2e/tests/build/styles/extract-css.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function () {
2020
'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }'
2121
}))
2222
.then(() => updateJsonFile('angular.json', workspaceJson => {
23-
const appArchitect = workspaceJson.projects['test-project'].architect;
23+
const appArchitect = workspaceJson.projects['test-project'].targets;
2424
appArchitect.build.options.styles = [
2525
{ input: 'src/string-style.css' },
2626
{ input: 'src/input-style.css' },

tests/legacy-cli/e2e/tests/build/styles/imports.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default function () {
4141
`})
4242
// change files to use preprocessor
4343
.then(() => updateJsonFile('angular.json', workspaceJson => {
44-
const appArchitect = workspaceJson.projects['test-project'].architect;
44+
const appArchitect = workspaceJson.projects['test-project'].targets;
4545
appArchitect.build.options.styles = [
4646
{ input: `src/styles.${ext}` }
4747
];
@@ -66,7 +66,7 @@ export default function () {
6666
// Also check imports work on ng test
6767
.then(() => !ejected && ng('test', '--watch=false'))
6868
.then(() => updateJsonFile('angular.json', workspaceJson => {
69-
const appArchitect = workspaceJson.projects['test-project'].architect;
69+
const appArchitect = workspaceJson.projects['test-project'].targets;
7070
appArchitect.build.options.styles = [
7171
{ input: `src/styles.css` }
7272
];

tests/legacy-cli/e2e/tests/build/styles/include-paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function () {
4747
.then(() => replaceInFile('src/app/app.component.ts', `'./app.component.css\'`,
4848
`'./app.component.scss', './app.component.styl', './app.component.less'`))
4949
.then(() => updateJsonFile('angular.json', workspaceJson => {
50-
const appArchitect = workspaceJson.projects['test-project'].architect;
50+
const appArchitect = workspaceJson.projects['test-project'].targets;
5151
appArchitect.build.options.styles = [
5252
{ input: 'src/styles.scss' },
5353
{ input: 'src/styles.styl' },

tests/legacy-cli/e2e/tests/build/styles/inline-urls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function () {
3838
}))
3939
.then(() => copyProjectAsset('images/spectrum.png', './src/assets/large.png'))
4040
.then(() => updateJsonFile('angular.json', workspaceJson => {
41-
const appArchitect = workspaceJson.projects['test-project'].architect;
41+
const appArchitect = workspaceJson.projects['test-project'].targets;
4242
appArchitect.build.options.styles = [
4343
{ input: 'src/styles.scss' }
4444
];

tests/legacy-cli/e2e/tests/build/styles/less.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function () {
2929
`})
3030
.then(() => deleteFile('src/app/app.component.css'))
3131
.then(() => updateJsonFile('angular.json', workspaceJson => {
32-
const appArchitect = workspaceJson.projects['test-project'].architect;
32+
const appArchitect = workspaceJson.projects['test-project'].targets;
3333
appArchitect.build.options.styles = [
3434
{ input: 'src/styles.less' }
3535
];

tests/legacy-cli/e2e/tests/build/styles/loaders.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function () {
2727
`})
2828
.then(() => deleteFile('src/app/app.component.css'))
2929
.then(() => updateJsonFile('angular.json', workspaceJson => {
30-
const appArchitect = workspaceJson.projects['test-project'].architect;
30+
const appArchitect = workspaceJson.projects['test-project'].targets;
3131
appArchitect.build.options.styles = [
3232
{ input: 'src/styles.scss' }
3333
];

tests/legacy-cli/e2e/tests/build/styles/material-import.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function () {
2525
})
2626
// change files to use preprocessor
2727
.then(() => updateJsonFile('angular.json', workspaceJson => {
28-
const appArchitect = workspaceJson.projects['test-project'].architect;
28+
const appArchitect = workspaceJson.projects['test-project'].targets;
2929
appArchitect.build.options.styles = [
3030
{ input: `src/styles.${ext}` }
3131
];

tests/legacy-cli/e2e/tests/build/styles/scss.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function () {
2929
`})
3030
.then(() => deleteFile('src/app/app.component.css'))
3131
.then(() => updateJsonFile('angular.json', workspaceJson => {
32-
const appArchitect = workspaceJson.projects['test-project'].architect;
32+
const appArchitect = workspaceJson.projects['test-project'].targets;
3333
appArchitect.build.options.styles = [
3434
{ input: 'src/styles.scss' }
3535
];

tests/legacy-cli/e2e/tests/build/styles/stylus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function () {
2929
`})
3030
.then(() => deleteFile('src/app/app.component.css'))
3131
.then(() => updateJsonFile('angular.json', workspaceJson => {
32-
const appArchitect = workspaceJson.projects['test-project'].architect;
32+
const appArchitect = workspaceJson.projects['test-project'].targets;
3333
appArchitect.build.options.styles = [
3434
{ input: 'src/styles.styl' }
3535
];

tests/legacy-cli/e2e/tests/commands/build/build-outdir.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function() {
88

99
return Promise.resolve()
1010
.then(() => updateJsonFile('angular.json', workspaceJson => {
11-
const appArchitect = workspaceJson.projects['test-project'].architect;
11+
const appArchitect = workspaceJson.projects['test-project'].targets;
1212
appArchitect.build.options.outputPath = './';
1313
}))
1414
.then(() => expectToFail(() => ng('build')))

tests/legacy-cli/e2e/tests/commands/config/config-set-serve-port.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import { ng } from '../../../utils/process';
33

44
export default function() {
55
return Promise.resolve()
6-
.then(() => ng('config', 'projects.test-project.architect.serve.options.port', '1234'))
6+
.then(() => ng('config', 'projects.test-project.targets.serve.options.port', '1234'))
77
.then(() => expectFileToMatch('angular.json', /"port": 1234/));
88
}

tests/legacy-cli/e2e/tests/lint/lint-no-project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function () {
1010

1111
return Promise.resolve()
1212
.then(() => updateJsonFile('angular.json', workspaceJson => {
13-
const appArchitect = workspaceJson.projects['test-project'].architect;
13+
const appArchitect = workspaceJson.projects['test-project'].targets;
1414
appArchitect.lint.options.tsConfig = undefined;
1515
}))
1616
.then(() => ng('lint', 'app', '--type-check'))

tests/legacy-cli/e2e/tests/misc/coverage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function () {
1616
.then(() => expectFileToMatch('coverage/lcov.info', 'polyfills.ts'))
1717
.then(() => expectFileToMatch('coverage/lcov.info', 'test.ts'))
1818
.then(() => updateJsonFile('angular.json', workspaceJson => {
19-
const appArchitect = workspaceJson.projects['test-project'].architect;
19+
const appArchitect = workspaceJson.projects['test-project'].targets;
2020
appArchitect.test.options.codeCoverageExclude = [
2121
'src/polyfills.ts',
2222
'**/test.ts'

tests/legacy-cli/e2e/tests/misc/fallback.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function () {
2121
// should correctly fallback to a changed index
2222
.then(() => moveFile('src/index.html', 'src/not-index.html'))
2323
.then(() => updateJsonFile('angular.json', workspaceJson => {
24-
const appArchitect = workspaceJson.projects['test-project'].architect;
24+
const appArchitect = workspaceJson.projects['test-project'].targets;
2525
appArchitect.build.options.index = 'src/not-index.html';
2626
}))
2727
.then(() => ngServe())

tests/legacy-cli/e2e/tests/test/e2e-baseurl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function () {
1111
return Promise.resolve()
1212
.then(() => expectToFail(() => ng('e2e', 'test-project-e2e', '--devServerTarget=')))
1313
.then(() => updateJsonFile('angular.json', workspaceJson => {
14-
const appArchitect = workspaceJson.projects['test-project'].architect;
14+
const appArchitect = workspaceJson.projects['test-project'].targets;
1515
appArchitect.serve.options.port = 4400;
1616
}))
1717
.then(() => ngServe())

tests/legacy-cli/e2e/tests/test/test-assets.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ export default function () {
3838
}))
3939
// Test failure condition (no assets in angular.json)
4040
.then(() => updateJsonFile('angular.json', workspaceJson => {
41-
const appArchitect = workspaceJson.projects['test-project'].architect;
41+
const appArchitect = workspaceJson.projects['test-project'].targets;
4242
appArchitect.build.options.assets = [];
4343
}))
4444
.then(() => expectToFail(() => ng('test', '--watch=false'),
4545
'Should fail because the assets to serve were not in the Angular CLI config'))
4646
// Test passing condition (assets are included)
4747
.then(() => updateJsonFile('angular.json', workspaceJson => {
48-
const appArchitect = workspaceJson.projects['test-project'].architect;
48+
const appArchitect = workspaceJson.projects['test-project'].targets;
4949
appArchitect.build.options.assets = [
5050
{ 'glob': '**/*', 'input': 'src/assets' },
5151
{ 'glob': 'file.txt' },

tests/legacy-cli/e2e/tests/test/test-environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default function () {
1515
`)
1616
.then(() => ng('test', '--watch=false'))
1717
.then(() => updateJsonFile('angular.json', configJson => {
18-
const appArchitect = configJson.projects['test-project'].architect;
18+
const appArchitect = configJson.projects['test-project'].targets;
1919
appArchitect.test.configurations = {
2020
production: {
2121
fileReplacements: [

tests/legacy-cli/e2e/tests/test/test-scripts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export default function () {
6363
// should fail because the global scripts were not added to scripts array
6464
.then(() => expectToFail(() => ng('test', '--watch=false')))
6565
.then(() => updateJsonFile('angular.json', workspaceJson => {
66-
const appArchitect = workspaceJson.projects['test-project'].architect;
66+
const appArchitect = workspaceJson.projects['test-project'].targets;
6767
appArchitect.test.options.scripts = [
6868
{ input: 'src/string-script.js' },
6969
{ input: 'src/input-script.js' }

tests/legacy-cli/e2e/tests/third-party/bootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function() {
1010
return Promise.resolve()
1111
.then(() => silentNpm('install', 'bootstrap@4.0.0-beta.3'))
1212
.then(() => updateJsonFile('angular.json', workspaceJson => {
13-
const appArchitect = workspaceJson.projects['test-project'].architect;
13+
const appArchitect = workspaceJson.projects['test-project'].targets;
1414
appArchitect.build.options.styles = [
1515
{ input: 'node_modules/bootstrap/dist/css/bootstrap.css' }
1616
];

tests/legacy-cli/e2e/tests/third-party/material-icons.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function() {
99
return Promise.resolve()
1010
.then(() => silentNpm('install', 'material-design-icons@3.0.1'))
1111
.then(() => updateJsonFile('angular.json', workspaceJson => {
12-
const appArchitect = workspaceJson.projects['test-project'].architect;
12+
const appArchitect = workspaceJson.projects['test-project'].targets;
1313
appArchitect.build.options.styles = [
1414
{ input: 'node_modules/material-design-icons/iconfont/material-icons.css' }
1515
];

tests/legacy-cli/e2e/utils/project.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ export function useNgVersion(version: string) {
177177
export function useCIDefaults(projectName = 'test-project') {
178178
return updateJsonFile('angular.json', workspaceJson => {
179179
// Disable progress reporting on CI to reduce spam.
180-
const appArchitect = workspaceJson.projects[projectName].architect;
181-
appArchitect.build.options.progress = false;
182-
appArchitect.test.options.progress = false;
180+
const appTargets = workspaceJson.projects[projectName].targets;
181+
appTargets.build.options.progress = false;
182+
appTargets.test.options.progress = false;
183183
// Disable auto-updating webdriver in e2e.
184-
const e2eArchitect = workspaceJson.projects[projectName + '-e2e'].architect;
185-
e2eArchitect.e2e.options.webdriverUpdate = false;
184+
const e2eTargets = workspaceJson.projects[projectName + '-e2e'].targets;
185+
e2eTargets.e2e.options.webdriverUpdate = false;
186186
})
187187
.then(() => updateJsonFile('package.json', json => {
188188
// We want to always use the same version of webdriver but can only do so on CircleCI.

0 commit comments

Comments
 (0)