Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

fix broken tests on node 12; latest pnpm requires node >= 14.19 #1613

Merged
merged 6 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions test/test-10-pnpm/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ const path = require('path');
const assert = require('assert');
const utils = require('../utils.js');

// ignore this test if nodejs <= 10 , as recent version of PNPM do not support nodejs=10
const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
if (MAJOR_VERSION < 12) {
console.log(
'skiping test as it requires nodejs >= 12 and got',
MAJOR_VERSION
);
if (utils.shouldSkipPnpm()) {
return;
}

Expand Down
8 changes: 1 addition & 7 deletions test/test-11-pnpm/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@ const path = require('path');
const assert = require('assert');
const utils = require('../utils.js');

// ignore this test if nodejs <= 10 , as recent version of PNPM do not support nodejs=10
const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
if (MAJOR_VERSION < 12) {
console.log(
'skiping test as it requires nodejs >= 12 and got',
MAJOR_VERSION
);
if (utils.shouldSkipPnpm()) {
return;
}

Expand Down
4 changes: 1 addition & 3 deletions test/test-12-compression-node-opcua/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const utils = require('../utils.js');
assert(!module.parent);
assert(__dirname === process.cwd());

// ignore this test if nodejs <= 10 , as recent version of PNPM do not support nodejs=10
const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
if (MAJOR_VERSION < 12) {
if (utils.shouldSkipPnpm()) {
return;
}

Expand Down
15 changes: 15 additions & 0 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,18 @@ module.exports.filesAfter = function (b, n) {
module.exports.vacuum.sync(ni);
}
};

module.exports.shouldSkipPnpm = function () {
// ignore this test if nodejs <= 14.19 , as recent version of PNPM do not support nodejs=14.19
const MAJOR_VERSION = parseInt(process.version.match(/v([0-9]+)/)[1], 10);
const MINOR_VERSION = parseInt(process.version.match(/v[0-9]+\.([0-9]+)/)[1], 10);
if (MAJOR_VERSION < 14 || (MAJOR_VERSION === 14 && MINOR_VERSION < 19)) {
console.log(
'skiping test as it requires nodejs >= 14.19 and got',
`${MAJOR_VERSION}.${MINOR_VERSION}`
);
return true;
}

return false;
}