Skip to content

Commit

Permalink
chore: handle as yet unrelease node.js versions (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgoss committed Mar 19, 2022
1 parent 9e31198 commit 6feaefb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
},
"types": "./lib/index.d.ts",
"engines": {
"node": "12 || 14 || 16 || 17"
"node": "12 || 14 || >=16"
},
"dependencies": {
"@cspotcode/source-map-support": "^0.7.0",
Expand Down
25 changes: 20 additions & 5 deletions src/cli/validate_node_engine_version_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ describe(validateNodeEngineVersion.name, () => {
// Act
validateNodeEngineVersion('v11.1.2', errorSpy, () => ({
engines: {
node: '12 || 14 || 16 || 17',
node: '12 || 14 || >=16',
},
}))

// Assert
expect(errorSpy).to.have.been.calledOnceWith(
'Cucumber can only run on Node.js versions 12 || 14 || 16 || 17. This Node.js version is v11.1.2'
'Cucumber can only run on Node.js versions 12 || 14 || >=16. This Node.js version is v11.1.2'
)
})

Expand All @@ -26,13 +26,13 @@ describe(validateNodeEngineVersion.name, () => {

validateNodeEngineVersion('v13.1.2', errorSpy, () => ({
engines: {
node: '12 || 14 || 16 || 17',
node: '12 || 14 || >=16',
},
}))

// Assert
expect(errorSpy).to.have.been.calledOnceWith(
'Cucumber can only run on Node.js versions 12 || 14 || 16 || 17. This Node.js version is v13.1.2'
'Cucumber can only run on Node.js versions 12 || 14 || >=16. This Node.js version is v13.1.2'
)
})

Expand All @@ -43,7 +43,22 @@ describe(validateNodeEngineVersion.name, () => {
// Act
validateNodeEngineVersion('v17.1.2', errorSpy, () => ({
engines: {
node: '12 || 14 || 16 || 17',
node: '12 || 14 || >=16',
},
}))

// Assert
expect(errorSpy).not.to.have.been.called()
})

it('does not call onError when the version is a version that isnt out yet at time of release', () => {
// Arrange
const errorSpy = sinon.spy()

// Act
validateNodeEngineVersion('v18.0.0', errorSpy, () => ({
engines: {
node: '12 || 14 || >=16',
},
}))

Expand Down

0 comments on commit 6feaefb

Please sign in to comment.