test: update to support targets & architect fields

This commit is contained in:
Charles Lyding 2018-09-10 15:17:00 -04:00 committed by Keen Yee Liau
parent f107d2de11
commit 57c049e507
39 changed files with 108 additions and 102 deletions

View File

@ -51,7 +51,7 @@ describe('PWA Schematic', () => {
schematicRunner.runSchematicAsync('ng-add', defaultOptions, appTree).toPromise().then(tree => { schematicRunner.runSchematicAsync('ng-add', defaultOptions, appTree).toPromise().then(tree => {
const configText = tree.readContent('/angular.json'); const configText = tree.readContent('/angular.json');
const config = JSON.parse(configText); const config = JSON.parse(configText);
const swFlag = config.projects.bar.targets.build.configurations.production.serviceWorker; const swFlag = config.projects.bar.architect.build.configurations.production.serviceWorker;
expect(swFlag).toEqual(true); expect(swFlag).toEqual(true);
done(); done();
}, done.fail); }, done.fail);
@ -131,7 +131,7 @@ describe('PWA Schematic', () => {
schematicRunner.runSchematicAsync('ng-add', defaultOptions, appTree).toPromise().then(tree => { schematicRunner.runSchematicAsync('ng-add', defaultOptions, appTree).toPromise().then(tree => {
const configText = tree.readContent('/angular.json'); const configText = tree.readContent('/angular.json');
const config = JSON.parse(configText); const config = JSON.parse(configText);
const targets = config.projects.bar.targets; const targets = config.projects.bar.architect;
['build', 'test'].forEach((target) => { ['build', 'test'].forEach((target) => {
expect(targets[target].options.assets).toContain('projects/bar/src/manifest.json'); expect(targets[target].options.assets).toContain('projects/bar/src/manifest.json');

View File

@ -64,7 +64,7 @@ describe('App Shell Schematic', () => {
const filePath = '/angular.json'; const filePath = '/angular.json';
const content = tree.readContent(filePath); const content = tree.readContent(filePath);
const workspace = JSON.parse(content); const workspace = JSON.parse(content);
const target = workspace.projects.bar.targets['app-shell']; const target = workspace.projects.bar.architect['app-shell'];
expect(target.options.browserTarget).toEqual('bar:build'); expect(target.options.browserTarget).toEqual('bar:build');
expect(target.options.serverTarget).toEqual('bar:server'); expect(target.options.serverTarget).toEqual('bar:server');
expect(target.options.route).toEqual('shell'); expect(target.options.route).toEqual('shell');

View File

@ -207,13 +207,13 @@ describe('Application Schematic', () => {
const config = JSON.parse(tree.readContent('/angular.json')); const config = JSON.parse(tree.readContent('/angular.json'));
const prj = config.projects.foo; const prj = config.projects.foo;
expect(prj.root).toEqual(''); expect(prj.root).toEqual('');
const buildOpt = prj.targets.build.options; const buildOpt = prj.architect.build.options;
expect(buildOpt.index).toEqual('src/index.html'); expect(buildOpt.index).toEqual('src/index.html');
expect(buildOpt.main).toEqual('src/main.ts'); expect(buildOpt.main).toEqual('src/main.ts');
expect(buildOpt.polyfills).toEqual('src/polyfills.ts'); expect(buildOpt.polyfills).toEqual('src/polyfills.ts');
expect(buildOpt.tsConfig).toEqual('src/tsconfig.app.json'); expect(buildOpt.tsConfig).toEqual('src/tsconfig.app.json');
const testOpt = prj.targets.test.options; const testOpt = prj.architect.test.options;
expect(testOpt.main).toEqual('src/test.ts'); expect(testOpt.main).toEqual('src/test.ts');
expect(testOpt.tsConfig).toEqual('src/tsconfig.spec.json'); expect(testOpt.tsConfig).toEqual('src/tsconfig.spec.json');
expect(testOpt.karmaConfig).toEqual('src/karma.conf.js'); expect(testOpt.karmaConfig).toEqual('src/karma.conf.js');

View File

@ -79,14 +79,14 @@ describe('Application Schematic', () => {
it('should set 2 targets for the app', () => { it('should set 2 targets for the app', () => {
const tree = schematicRunner.runSchematic('e2e', defaultOptions, workspaceTree); const tree = schematicRunner.runSchematic('e2e', defaultOptions, workspaceTree);
const workspace = JSON.parse(tree.readContent('/angular.json')); const workspace = JSON.parse(tree.readContent('/angular.json'));
const targets = workspace.projects.foo.targets; const targets = workspace.projects.foo.architect;
expect(Object.keys(targets)).toEqual(['e2e', 'lint']); expect(Object.keys(targets)).toEqual(['e2e', 'lint']);
}); });
it('should set the e2e options', () => { it('should set the e2e options', () => {
const tree = schematicRunner.runSchematic('e2e', defaultOptions, workspaceTree); const tree = schematicRunner.runSchematic('e2e', defaultOptions, workspaceTree);
const workspace = JSON.parse(tree.readContent('/angular.json')); const workspace = JSON.parse(tree.readContent('/angular.json'));
const e2eOptions = workspace.projects.foo.targets.e2e.options; const e2eOptions = workspace.projects.foo.architect.e2e.options;
expect(e2eOptions.protractorConfig).toEqual('projects/foo/protractor.conf.js'); expect(e2eOptions.protractorConfig).toEqual('projects/foo/protractor.conf.js');
expect(e2eOptions.devServerTarget).toEqual('app:serve'); expect(e2eOptions.devServerTarget).toEqual('app:serve');
}); });
@ -94,7 +94,7 @@ describe('Application Schematic', () => {
it('should set the lint options', () => { it('should set the lint options', () => {
const tree = schematicRunner.runSchematic('e2e', defaultOptions, workspaceTree); const tree = schematicRunner.runSchematic('e2e', defaultOptions, workspaceTree);
const workspace = JSON.parse(tree.readContent('/angular.json')); const workspace = JSON.parse(tree.readContent('/angular.json'));
const lintOptions = workspace.projects.foo.targets.lint.options; const lintOptions = workspace.projects.foo.architect.lint.options;
expect(lintOptions.tsConfig).toEqual('projects/foo/tsconfig.e2e.json'); expect(lintOptions.tsConfig).toEqual('projects/foo/tsconfig.e2e.json');
}); });
}); });

View File

@ -121,7 +121,7 @@ function migrateConfiguration(oldConfig: CliConfig, logger: logging.LoggerApi):
} }
const targetsConfig = extractTargetsConfig(oldConfig); const targetsConfig = extractTargetsConfig(oldConfig);
if (targetsConfig !== null) { if (targetsConfig !== null) {
config.targets = targetsConfig; config.architect = targetsConfig;
} }
context.logger.info(`Removing old config file (${oldConfigPath})`); context.logger.info(`Removing old config file (${oldConfigPath})`);
@ -577,7 +577,7 @@ function extractProjectsConfig(
}; };
e2eTargets.lint = e2eLintTarget; e2eTargets.lint = e2eLintTarget;
if (protractorConfig) { if (protractorConfig) {
e2eProject.targets = e2eTargets; e2eProject.architect = e2eTargets;
} }
return { name, project, e2eProject }; return { name, project, e2eProject };

View File

@ -124,6 +124,13 @@ describe('Migration to v6', () => {
return JSON.parse(tree.readContent(configPath)); return JSON.parse(tree.readContent(configPath));
} }
// tslint:disable-next-line:no-any
function getTarget(tree: UnitTestTree, targetName: string): any {
const project = getConfig(tree).projects.foo;
return project.architect[targetName];
}
describe('file creation/deletion', () => { describe('file creation/deletion', () => {
it('should delete the old config file', () => { it('should delete the old config file', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
@ -474,7 +481,7 @@ describe('Migration to v6', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const config = getConfig(tree); const config = getConfig(tree);
expect(config.targets).not.toBeDefined(); expect(config.architect).not.toBeDefined();
}); });
}); });
@ -526,7 +533,7 @@ describe('Migration to v6', () => {
it('should set build target', () => { it('should set build target', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const build = getConfig(tree).projects.foo.targets.build; const build = getTarget(tree, 'build');
expect(build.builder).toEqual('@angular-devkit/build-angular:browser'); expect(build.builder).toEqual('@angular-devkit/build-angular:browser');
expect(build.options.scripts).toEqual([]); expect(build.options.scripts).toEqual([]);
expect(build.options.styles).toEqual(['src/styles.css']); expect(build.options.styles).toEqual(['src/styles.css']);
@ -560,7 +567,7 @@ describe('Migration to v6', () => {
it('should not set baseHref on build & serve targets if not defined', () => { it('should not set baseHref on build & serve targets if not defined', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const build = getConfig(tree).projects.foo.targets.build; const build = getTarget(tree, 'build');
expect(build.options.baseHref).toBeUndefined(); expect(build.options.baseHref).toBeUndefined();
}); });
@ -569,7 +576,7 @@ describe('Migration to v6', () => {
config.apps[0].baseHref = '/base/href/'; config.apps[0].baseHref = '/base/href/';
tree.create(oldConfigPath, JSON.stringify(config, null, 2)); tree.create(oldConfigPath, JSON.stringify(config, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const build = getConfig(tree).projects.foo.targets.build; const build = getTarget(tree, 'build');
expect(build.options.baseHref).toEqual('/base/href/'); expect(build.options.baseHref).toEqual('/base/href/');
}); });
@ -577,19 +584,17 @@ describe('Migration to v6', () => {
baseConfig.apps[0].serviceWorker = true; baseConfig.apps[0].serviceWorker = true;
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const config = getConfig(tree); const build = getTarget(tree, 'build');
expect(config.projects.foo.targets.build.options.serviceWorker).toBeUndefined(); expect(build.options.serviceWorker).toBeUndefined();
expect( expect(build.configurations.production.serviceWorker).toBe(true);
config.projects.foo.targets.build.configurations.production.serviceWorker,
).toBe(true);
}); });
it('should add production configuration when no environments', () => { it('should add production configuration when no environments', () => {
delete baseConfig.apps[0].environments; delete baseConfig.apps[0].environments;
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const config = getConfig(tree); const build = getTarget(tree, 'build');
expect(config.projects.foo.targets.build.configurations).toEqual({ expect(build.configurations).toEqual({
production: { production: {
optimization: true, optimization: true,
outputHashing: 'all', outputHashing: 'all',
@ -608,8 +613,8 @@ describe('Migration to v6', () => {
tree.delete('/src/environments/environment.prod.ts'); tree.delete('/src/environments/environment.prod.ts');
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const config = getConfig(tree); const build = getTarget(tree, 'build');
expect(config.projects.foo.targets.build.configurations).toEqual({ expect(build.configurations).toEqual({
prod: { prod: {
fileReplacements: [{ fileReplacements: [{
replace: 'src/environments/environment.ts', replace: 'src/environments/environment.ts',
@ -633,7 +638,7 @@ describe('Migration to v6', () => {
it('should set the serve target', () => { it('should set the serve target', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const serve = getConfig(tree).projects.foo.targets.serve; const serve = getTarget(tree, 'serve');
expect(serve.builder).toEqual('@angular-devkit/build-angular:dev-server'); expect(serve.builder).toEqual('@angular-devkit/build-angular:dev-server');
expect(serve.options).toEqual({ expect(serve.options).toEqual({
browserTarget: 'foo:build', browserTarget: 'foo:build',
@ -646,7 +651,7 @@ describe('Migration to v6', () => {
it('should set the test target', () => { it('should set the test target', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const test = getConfig(tree).projects.foo.targets['test']; const test = getTarget(tree, 'test');
expect(test.builder).toEqual('@angular-devkit/build-angular:karma'); expect(test.builder).toEqual('@angular-devkit/build-angular:karma');
expect(test.options.main).toEqual('src/test.ts'); expect(test.options.main).toEqual('src/test.ts');
expect(test.options.polyfills).toEqual('src/polyfills.ts'); expect(test.options.polyfills).toEqual('src/polyfills.ts');
@ -665,7 +670,7 @@ describe('Migration to v6', () => {
it('should set the extract i18n target', () => { it('should set the extract i18n target', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const extract = getConfig(tree).projects.foo.targets['extract-i18n']; const extract = getTarget(tree, 'extract-i18n');
expect(extract.builder).toEqual('@angular-devkit/build-angular:extract-i18n'); expect(extract.builder).toEqual('@angular-devkit/build-angular:extract-i18n');
expect(extract.options).toBeDefined(); expect(extract.options).toBeDefined();
expect(extract.options.browserTarget).toEqual(`foo:build` ); expect(extract.options.browserTarget).toEqual(`foo:build` );
@ -674,7 +679,7 @@ describe('Migration to v6', () => {
it('should set the lint target', () => { it('should set the lint target', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const tslint = getConfig(tree).projects.foo.targets['lint']; const tslint = getTarget(tree, 'lint');
expect(tslint.builder).toEqual('@angular-devkit/build-angular:tslint'); expect(tslint.builder).toEqual('@angular-devkit/build-angular:tslint');
expect(tslint.options).toBeDefined(); expect(tslint.options).toBeDefined();
expect(tslint.options.tsConfig) expect(tslint.options.tsConfig)
@ -691,8 +696,8 @@ describe('Migration to v6', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const config = getConfig(tree); const build = getTarget(tree, 'build');
const budgets = config.projects.foo.targets.build.configurations.production.budgets; const budgets = build.configurations.production.budgets;
expect(budgets.length).toEqual(1); expect(budgets.length).toEqual(1);
expect(budgets[0].type).toEqual('bundle'); expect(budgets[0].type).toEqual('bundle');
expect(budgets[0].name).toEqual('main'); expect(budgets[0].name).toEqual('main');
@ -707,7 +712,7 @@ describe('Migration to v6', () => {
const e2eProject = getConfig(tree).projects['foo-e2e']; const e2eProject = getConfig(tree).projects['foo-e2e'];
expect(e2eProject.root).toBe('e2e'); expect(e2eProject.root).toBe('e2e');
expect(e2eProject.sourceRoot).toBe('e2e'); expect(e2eProject.sourceRoot).toBe('e2e');
const e2eOptions = e2eProject.targets.e2e; const e2eOptions = e2eProject.architect.e2e;
expect(e2eOptions.builder).toEqual('@angular-devkit/build-angular:protractor'); expect(e2eOptions.builder).toEqual('@angular-devkit/build-angular:protractor');
const options = e2eOptions.options; const options = e2eOptions.options;
expect(options.protractorConfig).toEqual('./protractor.conf.js'); expect(options.protractorConfig).toEqual('./protractor.conf.js');
@ -721,7 +726,7 @@ describe('Migration to v6', () => {
const e2eProject = getConfig(tree).projects['foo-e2e']; const e2eProject = getConfig(tree).projects['foo-e2e'];
expect(e2eProject.root).toBe('apps/app1/e2e'); expect(e2eProject.root).toBe('apps/app1/e2e');
expect(e2eProject.sourceRoot).toBe('apps/app1/e2e'); expect(e2eProject.sourceRoot).toBe('apps/app1/e2e');
const e2eOptions = e2eProject.targets.e2e; const e2eOptions = e2eProject.architect.e2e;
expect(e2eOptions.builder).toEqual('@angular-devkit/build-angular:protractor'); expect(e2eOptions.builder).toEqual('@angular-devkit/build-angular:protractor');
const options = e2eOptions.options; const options = e2eOptions.options;
expect(options.protractorConfig).toEqual('./protractor.conf.js'); expect(options.protractorConfig).toEqual('./protractor.conf.js');
@ -731,7 +736,7 @@ describe('Migration to v6', () => {
it('should set the lint target', () => { it('should set the lint target', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const tslint = getConfig(tree).projects['foo-e2e'].targets.lint; const tslint = getConfig(tree).projects['foo-e2e'].architect.lint;
expect(tslint.builder).toEqual('@angular-devkit/build-angular:tslint'); expect(tslint.builder).toEqual('@angular-devkit/build-angular:tslint');
expect(tslint.options).toBeDefined(); expect(tslint.options).toBeDefined();
expect(tslint.options.tsConfig).toEqual(['e2e/tsconfig.e2e.json']); expect(tslint.options.tsConfig).toEqual(['e2e/tsconfig.e2e.json']);
@ -988,7 +993,7 @@ describe('Migration to v6', () => {
tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2)); tree.create(oldConfigPath, JSON.stringify(baseConfig, null, 2));
tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree); tree = schematicRunner.runSchematic('migration-01', defaultOptions, tree);
const config = getConfig(tree); const config = getConfig(tree);
const target = config.projects.foo.targets.server; const target = config.projects.foo.architect.server;
expect(target).toBeDefined(); expect(target).toBeDefined();
expect(target.builder).toEqual('@angular-devkit/build-angular:server'); expect(target.builder).toEqual('@angular-devkit/build-angular:server');
expect(target.options.outputPath).toEqual('dist/server'); expect(target.options.outputPath).toEqual('dist/server');

View File

@ -45,11 +45,12 @@ describe('Service Worker Schematic', () => {
appTree = schematicRunner.runSchematic('application', appOptions, appTree); appTree = schematicRunner.runSchematic('application', appOptions, appTree);
}); });
it('should update the proudction configuration', () => { it('should update the production configuration', () => {
const tree = schematicRunner.runSchematic('service-worker', defaultOptions, appTree); const tree = schematicRunner.runSchematic('service-worker', defaultOptions, appTree);
const configText = tree.readContent('/angular.json'); const configText = tree.readContent('/angular.json');
const config = JSON.parse(configText); const config = JSON.parse(configText);
const swFlag = config.projects.bar.targets.build.configurations.production.serviceWorker; const swFlag = config.projects.bar.architect
.build.configurations.production.serviceWorker;
expect(swFlag).toEqual(true); expect(swFlag).toEqual(true);
}); });
@ -58,7 +59,8 @@ describe('Service Worker Schematic', () => {
const tree = schematicRunner.runSchematic('service-worker', options, appTree); const tree = schematicRunner.runSchematic('service-worker', options, appTree);
const configText = tree.readContent('/angular.json'); const configText = tree.readContent('/angular.json');
const config = JSON.parse(configText); const config = JSON.parse(configText);
const swFlag = config.projects.bar.targets.build.options.serviceWorker; const swFlag = config.projects.bar.architect
.build.options.serviceWorker;
expect(swFlag).toEqual(true); expect(swFlag).toEqual(true);
}); });

View File

@ -87,8 +87,8 @@ describe('Universal Schematic', () => {
}, },
}); });
const angularConfig = JSON.parse(tree.readContent('angular.json')); const angularConfig = JSON.parse(tree.readContent('angular.json'));
expect(angularConfig.projects.workspace.targets.server.options.tsConfig) expect(angularConfig.projects.workspace.architect
.toEqual('src/tsconfig.server.json'); .server.options.tsConfig).toEqual('src/tsconfig.server.json');
}); });
it('should create a tsconfig file for a generated application', () => { it('should create a tsconfig file for a generated application', () => {
@ -107,8 +107,8 @@ describe('Universal Schematic', () => {
}, },
}); });
const angularConfig = JSON.parse(tree.readContent('angular.json')); const angularConfig = JSON.parse(tree.readContent('angular.json'));
expect(angularConfig.projects.bar.targets.server.options.tsConfig) expect(angularConfig.projects.bar.architect
.toEqual('projects/bar/tsconfig.server.json'); .server.options.tsConfig).toEqual('projects/bar/tsconfig.server.json');
}); });
it('should add dependency: @angular/platform-server', () => { it('should add dependency: @angular/platform-server', () => {
@ -123,7 +123,7 @@ describe('Universal Schematic', () => {
const filePath = '/angular.json'; const filePath = '/angular.json';
const contents = tree.readContent(filePath); const contents = tree.readContent(filePath);
const config = JSON.parse(contents.toString()); const config = JSON.parse(contents.toString());
const targets = config.projects.bar.targets; const targets = config.projects.bar.architect;
expect(targets.server).toBeDefined(); expect(targets.server).toBeDefined();
expect(targets.server.builder).toBeDefined(); expect(targets.server.builder).toBeDefined();
const opts = targets.server.options; const opts = targets.server.options;

View File

@ -93,9 +93,9 @@ export default function () {
{ 'glob': '**/*', 'input': 'src/folder', 'output': 'folder' }, { 'glob': '**/*', 'input': 'src/folder', 'output': 'folder' },
{ 'glob': 'glob-asset.txt' }, { 'glob': 'glob-asset.txt' },
{ 'glob': 'output-asset.txt', 'output': 'output-folder' }, { 'glob': 'output-asset.txt', 'output': 'output-folder' },
{ 'glob': '**/*', 'input': 'node_modules/some-package/', 'output': 'package-folder' } { 'glob': '**/*', 'input': 'node_modules/some-package/', 'output': 'package-folder' },
]; ];
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.assets = assets; appArchitect.build.options.assets = assets;
appArchitect.test.options.assets = assets; appArchitect.test.options.assets = assets;
})) }))

View File

@ -25,11 +25,11 @@ export default function () {
'src/input-script.js': 'console.log(\'input-script\');', 'src/input-script.js': 'console.log(\'input-script\');',
'src/lazy-script.js': 'console.log(\'lazy-script\');', 'src/lazy-script.js': 'console.log(\'lazy-script\');',
'src/pre-rename-script.js': 'console.log(\'pre-rename-script\');', 'src/pre-rename-script.js': 'console.log(\'pre-rename-script\');',
'src/pre-rename-lazy-script.js': 'console.log(\'pre-rename-lazy-script\');' 'src/pre-rename-lazy-script.js': 'console.log(\'pre-rename-lazy-script\');',
}) })
.then(() => appendToFile('src/main.ts', 'import \'./string-script.js\';')) .then(() => appendToFile('src/main.ts', 'import \'./string-script.js\';'))
.then(() => updateJsonFile('angular.json', configJson => { .then(() => updateJsonFile('angular.json', configJson => {
const appArchitect = configJson.projects['test-project'].targets; const appArchitect = configJson.projects['test-project'].architect;
appArchitect.build.options.scripts = [ appArchitect.build.options.scripts = [
{ input: 'src/string-script.js' }, { input: 'src/string-script.js' },
{ input: 'src/zstring-script.js' }, { input: 'src/zstring-script.js' },

View File

@ -14,10 +14,10 @@ export default function () {
'src/input-style.css': '.input-style { color: red }', 'src/input-style.css': '.input-style { color: red }',
'src/lazy-style.css': '.lazy-style { color: red }', 'src/lazy-style.css': '.lazy-style { color: red }',
'src/pre-rename-style.css': '.pre-rename-style { color: red }', 'src/pre-rename-style.css': '.pre-rename-style { color: red }',
'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }' 'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }',
}) })
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/string-style.css' }, { input: 'src/string-style.css' },
{ input: 'src/input-style.css' }, { input: 'src/input-style.css' },

View File

@ -26,7 +26,7 @@ export default function () {
return Promise.resolve() return Promise.resolve()
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect['server'] = { appArchitect['server'] = {
builder: '@angular-devkit/build-angular:server', builder: '@angular-devkit/build-angular:server',
options: { options: {

View File

@ -28,14 +28,14 @@ export default function () {
expectation: 'warning', expectation: 'warning',
message: 'Budget warning: all, min warning', message: 'Budget warning: all, min warning',
budget: { type: 'all', minimumWarning: '100mb' }, budget: { type: 'all', minimumWarning: '100mb' },
} },
]; ];
const promiseFactories = budgetConfigs.map(cfg => { const promiseFactories = budgetConfigs.map(cfg => {
if (cfg.expectation === 'error') { if (cfg.expectation === 'error') {
return () => { return () => {
return updateJsonFile('angular.json', (json) => { return updateJsonFile('angular.json', (json) => {
json.projects['test-project'].targets.build.options.budgets = [cfg.budget]; json.projects['test-project'].architect.build.options.budgets = [cfg.budget];
}) })
.then(() => expectToFail(() => ng('build', '--optimization'))) .then(() => expectToFail(() => ng('build', '--optimization')))
.then(errorMessage => { .then(errorMessage => {
@ -47,7 +47,7 @@ export default function () {
} else if (cfg.expectation === 'warning') { } else if (cfg.expectation === 'warning') {
return () => { return () => {
return updateJsonFile('angular.json', (json) => { return updateJsonFile('angular.json', (json) => {
json.projects['test-project'].targets.build.options.budgets = [cfg.budget]; json.projects['test-project'].architect.build.options.budgets = [cfg.budget];
}) })
.then(() => ng('build', '--optimization')) .then(() => ng('build', '--optimization'))
.then(({ stdout }) => { .then(({ stdout }) => {
@ -59,7 +59,7 @@ export default function () {
} else { // pass } else { // pass
return () => { return () => {
return updateJsonFile('angular.json', (json) => { return updateJsonFile('angular.json', (json) => {
json.projects['test-project'].targets.build.options.budgets = [cfg.budget]; json.projects['test-project'].architect.build.options.budgets = [cfg.budget];
}) })
.then(() => ng('build', '--optimization')) .then(() => ng('build', '--optimization'))
.then(({ stdout }) => { .then(({ stdout }) => {

View File

@ -8,9 +8,9 @@ export default async function() {
// Add a lazy module // Add a lazy module
await ng('generate', 'module', 'lazy'); await ng('generate', 'module', 'lazy');
await updateJsonFile('angular.json', workspaceJson => { await updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.lazyModules = [ appArchitect.build.options.lazyModules = [
'src/app/lazy/lazy.module' 'src/app/lazy/lazy.module',
]; ];
}); });

View File

@ -7,12 +7,12 @@ export default function() {
// Try a prod build. // Try a prod build.
return Promise.resolve() return Promise.resolve()
.then(() => updateJsonFile('angular.json', configJson => { .then(() => updateJsonFile('angular.json', configJson => {
const appArchitect = configJson.projects['test-project'].targets; const appArchitect = configJson.projects['test-project'].architect;
appArchitect.build.configurations['prod-env'] = { appArchitect.build.configurations['prod-env'] = {
fileReplacements: [ fileReplacements: [
{ {
src: 'src/environments/environment.ts', src: 'src/environments/environment.ts',
replaceWith: 'src/environments/environment.prod.ts' replaceWith: 'src/environments/environment.prod.ts',
} }
], ],
}; };

View File

@ -19,7 +19,7 @@ export default function() {
.then(() => expectFileToExist('./build-output/main.js')) .then(() => expectFileToExist('./build-output/main.js'))
.then(() => expectToFail(expectGitToBeClean)) .then(() => expectToFail(expectGitToBeClean))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.outputPath = 'config-build-output'; appArchitect.build.options.outputPath = 'config-build-output';
})) }))
.then(() => ng('build')) .then(() => ng('build'))

View File

@ -36,14 +36,14 @@ export default function () {
dependencies['@angular/platform-server'] = platformServerVersion; dependencies['@angular/platform-server'] = platformServerVersion;
})) }))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect['server'] = { appArchitect['server'] = {
builder: '@angular-devkit/build-angular:server', builder: '@angular-devkit/build-angular:server',
options: { options: {
outputPath: 'dist/test-project-server', outputPath: 'dist/test-project-server',
main: 'src/main.server.ts', main: 'src/main.server.ts',
tsConfig: 'src/tsconfig.server.json' tsConfig: 'src/tsconfig.server.json',
} },
}; };
})) }))
.then(() => writeFile('./src/tsconfig.server.json', ` .then(() => writeFile('./src/tsconfig.server.json', `

View File

@ -32,7 +32,7 @@ export default function() {
// stuck to the first build done // stuck to the first build done
return silentNpm('remove', '@angular/service-worker') return silentNpm('remove', '@angular/service-worker')
.then(() => silentNpm('install', '@angular/service-worker')) .then(() => silentNpm('install', '@angular/service-worker'))
.then(() => ng('config', 'projects.test-project.targets.build.options.serviceWorker', 'true')) .then(() => ng('config', 'projects.test-project.architect.build.options.serviceWorker', 'true'))
.then(() => writeFile('src/ngsw-config.json', JSON.stringify(MANIFEST, null, 2))) .then(() => writeFile('src/ngsw-config.json', JSON.stringify(MANIFEST, null, 2)))
.then(() => ng('build', '--optimization')) .then(() => ng('build', '--optimization'))
.then(() => expectFileToExist(join(process.cwd(), 'dist'))) .then(() => expectFileToExist(join(process.cwd(), 'dist')))

View File

@ -21,7 +21,7 @@ export default async function () {
}); });
await deleteFile('src/app/app.component.css'); await deleteFile('src/app/app.component.css');
await updateJsonFile('angular.json', workspaceJson => { await updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/styles.scss' }, { input: 'src/styles.scss' },
]; ];

View File

@ -17,10 +17,10 @@ export default function () {
'src/input-style.css': '.input-style { color: red }', 'src/input-style.css': '.input-style { color: red }',
'src/lazy-style.css': '.lazy-style { color: red }', 'src/lazy-style.css': '.lazy-style { color: red }',
'src/pre-rename-style.css': '.pre-rename-style { color: red }', 'src/pre-rename-style.css': '.pre-rename-style { color: red }',
'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }' 'src/pre-rename-lazy-style.css': '.pre-rename-lazy-style { color: red }',
})) }))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/string-style.css' }, { input: 'src/string-style.css' },
{ input: 'src/input-style.css' }, { input: 'src/input-style.css' },

View File

@ -41,9 +41,9 @@ export default function () {
`}) `})
// change files to use preprocessor // change files to use preprocessor
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: `src/styles.${ext}` } { input: `src/styles.${ext}` },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',
@ -66,9 +66,9 @@ export default function () {
// Also check imports work on ng test // Also check imports work on ng test
.then(() => !ejected && ng('test', '--watch=false')) .then(() => !ejected && ng('test', '--watch=false'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: `src/styles.css` } { input: `src/styles.css` },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',

View File

@ -47,7 +47,7 @@ export default function () {
.then(() => replaceInFile('src/app/app.component.ts', `'./app.component.css\'`, .then(() => replaceInFile('src/app/app.component.ts', `'./app.component.css\'`,
`'./app.component.scss', './app.component.styl', './app.component.less'`)) `'./app.component.scss', './app.component.styl', './app.component.less'`))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/styles.scss' }, { input: 'src/styles.scss' },
{ input: 'src/styles.styl' }, { input: 'src/styles.styl' },

View File

@ -29,9 +29,9 @@ export default function () {
`}) `})
.then(() => deleteFile('src/app/app.component.css')) .then(() => deleteFile('src/app/app.component.css'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/styles.less' } { input: 'src/styles.less' },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',

View File

@ -27,9 +27,9 @@ export default function () {
`}) `})
.then(() => deleteFile('src/app/app.component.css')) .then(() => deleteFile('src/app/app.component.css'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/styles.scss' } { input: 'src/styles.scss' },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',

View File

@ -25,9 +25,9 @@ export default function () {
}) })
// change files to use preprocessor // change files to use preprocessor
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: `src/styles.${ext}` } { input: `src/styles.${ext}` },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',

View File

@ -29,9 +29,9 @@ export default function () {
`}) `})
.then(() => deleteFile('src/app/app.component.css')) .then(() => deleteFile('src/app/app.component.css'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/styles.scss' } { input: 'src/styles.scss' },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',

View File

@ -29,9 +29,9 @@ export default function () {
`}) `})
.then(() => deleteFile('src/app/app.component.css')) .then(() => deleteFile('src/app/app.component.css'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'src/styles.styl' } { input: 'src/styles.styl' },
]; ];
})) }))
.then(() => replaceInFile('src/app/app.component.ts', .then(() => replaceInFile('src/app/app.component.ts',

View File

@ -8,13 +8,10 @@ export default function() {
return Promise.resolve() return Promise.resolve()
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.outputPath = './'; appArchitect.build.options.outputPath = './';
})) }))
.then(() => expectToFail(() => ng('build'))) .then(() => expectToFail(() => ng('build')))
.then(() => expectToFail(() => ng('serve'))) .then(() => expectToFail(() => ng('serve')))
.then(() => expectToFail(() => ng('eject'))); .then(() => expectToFail(() => ng('eject')));
} }

View File

@ -3,6 +3,6 @@ import { ng } from '../../../utils/process';
export default function() { export default function() {
return Promise.resolve() return Promise.resolve()
.then(() => ng('config', 'projects.test-project.targets.serve.options.port', '1234')) .then(() => ng('config', 'projects.test-project.architect.serve.options.port', '1234'))
.then(() => expectFileToMatch('angular.json', /"port": 1234/)); .then(() => expectFileToMatch('angular.json', /"port": 1234/));
} }

View File

@ -10,7 +10,7 @@ export default function () {
return Promise.resolve() return Promise.resolve()
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.lint.options.tsConfig = undefined; appArchitect.lint.options.tsConfig = undefined;
})) }))
.then(() => ng('lint', 'app', '--type-check')) .then(() => ng('lint', 'app', '--type-check'))

View File

@ -16,10 +16,10 @@ export default function () {
.then(() => expectFileToMatch('coverage/lcov.info', 'polyfills.ts')) .then(() => expectFileToMatch('coverage/lcov.info', 'polyfills.ts'))
.then(() => expectFileToMatch('coverage/lcov.info', 'test.ts')) .then(() => expectFileToMatch('coverage/lcov.info', 'test.ts'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.test.options.codeCoverageExclude = [ appArchitect.test.options.codeCoverageExclude = [
'src/polyfills.ts', 'src/polyfills.ts',
'**/test.ts' '**/test.ts',
]; ];
})) }))
.then(() => ng('test', '--watch=false', '--code-coverage')) .then(() => ng('test', '--watch=false', '--code-coverage'))

View File

@ -21,7 +21,7 @@ export default function () {
// should correctly fallback to a changed index // should correctly fallback to a changed index
.then(() => moveFile('src/index.html', 'src/not-index.html')) .then(() => moveFile('src/index.html', 'src/not-index.html'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.index = 'src/not-index.html'; appArchitect.build.options.index = 'src/not-index.html';
})) }))
.then(() => ngServe()) .then(() => ngServe())

View File

@ -11,7 +11,7 @@ export default function () {
return Promise.resolve() return Promise.resolve()
.then(() => expectToFail(() => ng('e2e', 'test-project-e2e', '--devServerTarget='))) .then(() => expectToFail(() => ng('e2e', 'test-project-e2e', '--devServerTarget=')))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.serve.options.port = 4400; appArchitect.serve.options.port = 4400;
})) }))
.then(() => ngServe()) .then(() => ngServe())

View File

@ -38,14 +38,14 @@ export default function () {
})) }))
// Test failure condition (no assets in angular.json) // Test failure condition (no assets in angular.json)
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'];
appArchitect.build.options.assets = []; appArchitect.build.options.assets = [];
})) }))
.then(() => expectToFail(() => ng('test', '--watch=false'), .then(() => expectToFail(() => ng('test', '--watch=false'),
'Should fail because the assets to serve were not in the Angular CLI config')) 'Should fail because the assets to serve were not in the Angular CLI config'))
// Test passing condition (assets are included) // Test passing condition (assets are included)
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.assets = [ appArchitect.build.options.assets = [
{ 'glob': '**/*', 'input': 'src/assets' }, { 'glob': '**/*', 'input': 'src/assets' },
{ 'glob': 'file.txt' }, { 'glob': 'file.txt' },

View File

@ -15,13 +15,13 @@ export default function () {
`) `)
.then(() => ng('test', '--watch=false')) .then(() => ng('test', '--watch=false'))
.then(() => updateJsonFile('angular.json', configJson => { .then(() => updateJsonFile('angular.json', configJson => {
const appArchitect = configJson.projects['test-project'].targets; const appArchitect = configJson.projects['test-project'].architect;
appArchitect.test.configurations = { appArchitect.test.configurations = {
production: { production: {
fileReplacements: [ fileReplacements: [
{ {
src: 'src/environments/environment.ts', src: 'src/environments/environment.ts',
replaceWith: 'src/environments/environment.prod.ts' replaceWith: 'src/environments/environment.prod.ts',
} }
], ],
} }

View File

@ -63,10 +63,10 @@ export default function () {
// should fail because the global scripts were not added to scripts array // should fail because the global scripts were not added to scripts array
.then(() => expectToFail(() => ng('test', '--watch=false'))) .then(() => expectToFail(() => ng('test', '--watch=false')))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.test.options.scripts = [ appArchitect.test.options.scripts = [
{ input: 'src/string-script.js' }, { input: 'src/string-script.js' },
{ input: 'src/input-script.js' } { input: 'src/input-script.js' },
]; ];
})) }))
// should pass now // should pass now

View File

@ -10,12 +10,12 @@ export default function() {
return Promise.resolve() return Promise.resolve()
.then(() => silentNpm('install', 'bootstrap@4.0.0-beta.3')) .then(() => silentNpm('install', 'bootstrap@4.0.0-beta.3'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'node_modules/bootstrap/dist/css/bootstrap.css' } { input: 'node_modules/bootstrap/dist/css/bootstrap.css' },
]; ];
appArchitect.build.options.scripts = [ appArchitect.build.options.scripts = [
{ input: 'node_modules/bootstrap/dist/js/bootstrap.js' } { input: 'node_modules/bootstrap/dist/js/bootstrap.js' },
]; ];
})) }))
.then(() => ng('build', '--extract-css')) .then(() => ng('build', '--extract-css'))

View File

@ -9,9 +9,9 @@ export default function() {
return Promise.resolve() return Promise.resolve()
.then(() => silentNpm('install', 'material-design-icons@3.0.1')) .then(() => silentNpm('install', 'material-design-icons@3.0.1'))
.then(() => updateJsonFile('angular.json', workspaceJson => { .then(() => updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].targets; const appArchitect = workspaceJson.projects['test-project'].architect;
appArchitect.build.options.styles = [ appArchitect.build.options.styles = [
{ input: 'node_modules/material-design-icons/iconfont/material-icons.css' } { input: 'node_modules/material-design-icons/iconfont/material-icons.css' },
]; ];
})) }))
.then(() => ng('build', '--extract-css')) .then(() => ng('build', '--extract-css'))

View File

@ -182,11 +182,13 @@ export function useNgVersion(version: string) {
export function useCIDefaults(projectName = 'test-project') { export function useCIDefaults(projectName = 'test-project') {
return updateJsonFile('angular.json', workspaceJson => { return updateJsonFile('angular.json', workspaceJson => {
// Disable progress reporting on CI to reduce spam. // Disable progress reporting on CI to reduce spam.
const appTargets = workspaceJson.projects[projectName].targets; const project = workspaceJson.projects[projectName];
const appTargets = project.targets || project.architect;
appTargets.build.options.progress = false; appTargets.build.options.progress = false;
appTargets.test.options.progress = false; appTargets.test.options.progress = false;
// Disable auto-updating webdriver in e2e. // Disable auto-updating webdriver in e2e.
const e2eTargets = workspaceJson.projects[projectName + '-e2e'].targets; const e2eProject = workspaceJson.projects[projectName + '-e2e'];
const e2eTargets = e2eProject.targets || e2eProject.architect;
e2eTargets.e2e.options.webdriverUpdate = false; e2eTargets.e2e.options.webdriverUpdate = false;
}) })
.then(() => updateJsonFile('package.json', json => { .then(() => updateJsonFile('package.json', json => {