mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
feat(e2e) validate node version
This commit is contained in:
@ -125,10 +125,24 @@ async function run() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const navigate = url => driver => new Page(driver, url).navigate();
|
function parseSemver(str) {
|
||||||
|
return /(\d+)\.(\d+)\.(\d+)/
|
||||||
|
.exec(str)
|
||||||
|
.slice(1)
|
||||||
|
.map(Number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateNodeVersion(version) {
|
||||||
|
const [major, minor] = parseSemver(version);
|
||||||
|
|
||||||
|
if (major < 7 || (major === 7 && minor < 6)) {
|
||||||
|
throw new Error('Running the end-to-end tests requires Node version 7.6.0 or higher.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Invoke run() only if executed directly i.e. `node ./scripts/e2e`
|
// Invoke run() only if executed directly i.e. `node ./scripts/e2e`
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
|
validateNodeVersion(process.version);
|
||||||
run();
|
run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user