test: support 'latest'/'latest@X' Electron version strings (#37840)
This commit is contained in:
parent
251e567eff
commit
9563b5f98b
1 changed files with 15 additions and 1 deletions
|
@ -64,10 +64,24 @@ if (args.runners !== undefined) {
|
|||
async function main () {
|
||||
if (args.electronVersion) {
|
||||
const versions = await ElectronVersions.create();
|
||||
if (!versions.isVersion(args.electronVersion)) {
|
||||
if (args.electronVersion === 'latest') {
|
||||
args.electronVersion = versions.latest.version;
|
||||
} else if (args.electronVersion.startsWith('latest@')) {
|
||||
const majorVersion = parseInt(args.electronVersion.slice('latest@'.length));
|
||||
const ver = versions.inMajor(majorVersion).slice(-1)[0];
|
||||
if (ver) {
|
||||
args.electronVersion = ver.version;
|
||||
} else {
|
||||
console.log(`${fail} '${majorVersion}' is not a recognized Electron major version`);
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (!versions.isVersion(args.electronVersion)) {
|
||||
console.log(`${fail} '${args.electronVersion}' is not a recognized Electron version`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const versionString = `v${args.electronVersion}`;
|
||||
console.log(`Running against Electron ${versionString.green}`);
|
||||
}
|
||||
|
||||
const [lastSpecHash, lastSpecInstallHash] = loadLastSpecHash();
|
||||
|
|
Loading…
Reference in a new issue