mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 19:13:34 +08:00
test: pin Angular snapshot versions
Next step is to set up Renovate to send PRs against this package.json file
This commit is contained in:
parent
7f879dc60b
commit
b344ba4b38
@ -206,15 +206,9 @@ workflows:
|
|||||||
- e2e-cli-ng-snapshots:
|
- e2e-cli-ng-snapshots:
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: master
|
|
||||||
- e2e-cli-ivy-snapshots:
|
- e2e-cli-ivy-snapshots:
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: master
|
|
||||||
- snapshot_publish:
|
- snapshot_publish:
|
||||||
requires:
|
requires:
|
||||||
- test
|
- test
|
||||||
|
16
tests/legacy-cli/e2e/ng-snapshot/package.json
Normal file
16
tests/legacy-cli/e2e/ng-snapshot/package.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -191,30 +191,40 @@ export function useSha() {
|
|||||||
// 7.0.0-beta.4+dd2a650
|
// 7.0.0-beta.4+dd2a650
|
||||||
// 6.1.6+4a8d56a
|
// 6.1.6+4a8d56a
|
||||||
const label = argv['ng-tag'] ? argv['ng-tag'] : '';
|
const label = argv['ng-tag'] ? argv['ng-tag'] : '';
|
||||||
|
const ngSnapshotVersions = require('../ng-snapshot/package.json');
|
||||||
return updateJsonFile('package.json', json => {
|
return updateJsonFile('package.json', json => {
|
||||||
// Install over the project with snapshot builds.
|
// 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\//))
|
.filter(name => name.match(/^@angular\//))
|
||||||
.forEach(name => {
|
.forEach(name => {
|
||||||
const pkgName = name.split(/\//)[1];
|
const pkgName = name.split(/\//)[1];
|
||||||
if (pkgName == 'cli') {
|
if (pkgName == 'cli') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
json['dependencies'][`@angular/${pkgName}`]
|
if (label) {
|
||||||
|
json[key][`@angular/${pkgName}`]
|
||||||
= `github:angular/${pkgName}-builds${label}`;
|
= `github:angular/${pkgName}-builds${label}`;
|
||||||
});
|
} else {
|
||||||
|
const replacement = ngSnapshotVersions.dependencies[`@angular/${pkgName}`];
|
||||||
Object.keys(json['devDependencies'] || {})
|
if (!replacement) {
|
||||||
.filter(name => name.match(/^@angular\//))
|
missingSnapshots.push(`missing @angular/${pkgName}`);
|
||||||
.forEach(name => {
|
}
|
||||||
const pkgName = name.split(/\//)[1];
|
json[key][`@angular/${pkgName}`] = replacement;
|
||||||
if (pkgName == 'cli') {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
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';
|
json['devDependencies']['typescript'] = '~3.1.1';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,7 @@ Error.stackTraceLimit = Infinity;
|
|||||||
* --noglobal Skip linking your local @angular/cli directory. Can save a few seconds.
|
* --noglobal Skip linking your local @angular/cli directory. Can save a few seconds.
|
||||||
* --nosilent Never silence ng commands.
|
* --nosilent Never silence ng commands.
|
||||||
* --ng-tag=TAG Use a specific tag for build snapshots. Similar to ng-snapshots but point to a
|
* --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.
|
* --ng-snapshots Install angular snapshot builds in the test project.
|
||||||
* --ivy Use the Ivy compiler.
|
* --ivy Use the Ivy compiler.
|
||||||
* --glob Run tests matching this glob pattern (relative to tests/e2e/).
|
* --glob Run tests matching this glob pattern (relative to tests/e2e/).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user