chore: refactored minimum Node Major version to variable (#24188)

This commit is contained in:
Marcin Strzyz 2023-07-18 10:57:48 -07:00 committed by GitHub
parent bca32f389b
commit 0eb94aaa79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,18 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const minimumMajorNodeVersion = 14;
const currentNodeVersion = process.versions.node;
const semver = currentNodeVersion.split('.');
const [major] = [+semver[0]];
if (major < 14) {
if (major < minimumMajorNodeVersion) {
// eslint-disable-next-line no-console
console.error(
'You are running Node.js ' +
currentNodeVersion +
'.\n' +
'Playwright requires Node.js 14 or higher. \n' +
`Playwright requires Node.js ${minimumMajorNodeVersion} or higher. \n` +
'Please update your version of Node.js.'
);
process.exit(1);