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