Skip to content

Commit

Permalink
test: skip static-import on > v21 (#81)
Browse files Browse the repository at this point in the history
Better fix for #80

Closes #73
  • Loading branch information
timfish committed May 28, 2024
1 parent 00b01ff commit 1e05e4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
File renamed without changes.
8 changes: 7 additions & 1 deletion test/version-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ process.env.IITM_TEST_FILE = filename

const [processMajor, processMinor] = process.versions.node.split('.').map(Number)

const match = filename.match(/v([0-9]+)(?:\.([0-9]+))?/)
const match = filename.match(/v([0-9]+)(?:\.([0-9]+))?(?:-v([0-9]+))?/)

const majorRequirement = match ? match[1] : 0
const minorRequirement = match && match[2]
const majorMax = match ? match[3] : Infinity

if (processMajor < majorRequirement) {
console.log(`skipping ${filename} as this is Node.js v${processMajor} and test wants v${majorRequirement}`)
Expand All @@ -25,3 +26,8 @@ if (processMajor <= majorRequirement && processMinor < minorRequirement) {
console.log(`skipping ${filename} as this is Node.js v${processMajor}.${processMinor} and test wants >=v${majorRequirement}.${minorRequirement}`)
process.exit(0)
}

if (processMajor > majorMax) {
console.log(`skipping ${filename} as this is Node.js v${processMajor} and test wants <=v${majorMax}`)
process.exit(0)
}

0 comments on commit 1e05e4b

Please sign in to comment.