diff --git a/.circleci/config.yml b/.circleci/config.yml index 97ca2ca9de..fa0272b0eb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -206,15 +206,9 @@ workflows: - e2e-cli-ng-snapshots: requires: - build - filters: - branches: - only: master - e2e-cli-ivy-snapshots: requires: - build - filters: - branches: - only: master - snapshot_publish: requires: - test diff --git a/tests/legacy-cli/e2e/ng-snapshot/package.json b/tests/legacy-cli/e2e/ng-snapshot/package.json new file mode 100644 index 0000000000..68b5e98010 --- /dev/null +++ b/tests/legacy-cli/e2e/ng-snapshot/package.json @@ -0,0 +1,16 @@ +{ + "description": "snapshot versions of Angular for e2e testing", + "private": true, + "dependencies": { + "@angular/core": "github:angular/core-builds#1bc5b9bba8227986648e0acacf1c0fe003325050", + "@angular/common": "github:angular/common-builds#8e5855a592e822c8c01ed8c76ddcb613adec8c28", + "@angular/platform-browser": "github:angular/platform-browser-builds#a680285668388f1ea495b4418e258dd3a7dfddbf", + "@angular/compiler": "github:angular/compiler-builds#5010a0df7672579c111122e703ae2a31e533bfe9", + "@angular/compiler-cli": "github:angular/compiler-cli-builds#b2f95784933f67e50916d5491046672452c4470a", + "@angular/animations": "github:angular/animations-builds#2ae4075eba3acd11c871ea9ce9acec0ca5679bb1", + "@angular/forms": "github:angular/forms-builds#5030b6e9a7174b525ee8e6ee60a3a3a91ef95a3c", + "@angular/platform-browser-dynamic": "github:angular/platform-browser-dynamic-builds#4fac5c151609dcf3d4b5bc23f7fa391c6ba393e4", + "@angular/router": "github:angular/router-builds#05ee97ccb532b2f8f18cc072034d5d3e51492a3c", + "@angular/language-service": "github:angular/language-service-builds#f0414cf6ca0825aa977639cf41d1935dd5791a6d" + } +} \ No newline at end of file diff --git a/tests/legacy-cli/e2e/utils/project.ts b/tests/legacy-cli/e2e/utils/project.ts index f9ca35ce8d..d8139055fc 100644 --- a/tests/legacy-cli/e2e/utils/project.ts +++ b/tests/legacy-cli/e2e/utils/project.ts @@ -191,30 +191,40 @@ export function useSha() { // 7.0.0-beta.4+dd2a650 // 6.1.6+4a8d56a const label = argv['ng-tag'] ? argv['ng-tag'] : ''; + const ngSnapshotVersions = require('../ng-snapshot/package.json'); return updateJsonFile('package.json', json => { // Install over the project with snapshot builds. - Object.keys(json['dependencies'] || {}) + function replaceDependencies(key: string) { + const missingSnapshots = []; + Object.keys(json[key] || {}) .filter(name => name.match(/^@angular\//)) .forEach(name => { const pkgName = name.split(/\//)[1]; if (pkgName == 'cli') { return; } - json['dependencies'][`@angular/${pkgName}`] - = `github:angular/${pkgName}-builds${label}`; - }); - - Object.keys(json['devDependencies'] || {}) - .filter(name => name.match(/^@angular\//)) - .forEach(name => { - const pkgName = name.split(/\//)[1]; - if (pkgName == 'cli') { - return; + if (label) { + json[key][`@angular/${pkgName}`] + = `github:angular/${pkgName}-builds${label}`; + } else { + const replacement = ngSnapshotVersions.dependencies[`@angular/${pkgName}`]; + if (!replacement) { + missingSnapshots.push(`missing @angular/${pkgName}`); + } + json[key][`@angular/${pkgName}`] = replacement; } - json['devDependencies'][`@angular/${pkgName}`] - = `github:angular/${pkgName}-builds${label}`; }); - + if (missingSnapshots.length > 0) { + throw new Error('e2e test with --ng-snapshots requires all angular packages be ' + + 'listed in tests/legacy-cli/e2e/ng-snapshot/package.json.\nErrors:\n' + missingSnapshots.join('\n ')); + } + } + try { + replaceDependencies('dependencies'); + replaceDependencies('devDependencies'); + } catch (e) { + return Promise.reject(e); + } json['devDependencies']['typescript'] = '~3.1.1'; }); } else { diff --git a/tests/legacy-cli/e2e_runner.ts b/tests/legacy-cli/e2e_runner.ts index 54f0d2bece..171aeb4449 100644 --- a/tests/legacy-cli/e2e_runner.ts +++ b/tests/legacy-cli/e2e_runner.ts @@ -27,7 +27,7 @@ Error.stackTraceLimit = Infinity; * --noglobal Skip linking your local @angular/cli directory. Can save a few seconds. * --nosilent Never silence ng commands. * --ng-tag=TAG Use a specific tag for build snapshots. Similar to ng-snapshots but point to a - * tag of using the latest master. + * tag instead of using the latest master. * --ng-snapshots Install angular snapshot builds in the test project. * --ivy Use the Ivy compiler. * --glob Run tests matching this glob pattern (relative to tests/e2e/).