Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion lib/cli/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = async (process, validateEngines) => {

// It is now safe to log a warning if they are using a version of node that is not going to fail on syntax errors but is still unsupported and untested and might not work reliably.
// This is safe to use the logger now which we want since this will show up in the error log too.
if (!satisfies(validateEngines.node, validateEngines.engines)) {
if (!satisfies(validateEngines.node, validateEngines.engines, { includePrerelease: true })) {
log.warn('cli', validateEngines.unsupportedMessage)
}

Expand Down
25 changes: 25 additions & 0 deletions test/lib/cli/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,31 @@ t.test('unsupported node version', async t => {
)
})

t.test('prerelease node versions', async t => {
for (const [version, supported] of [
['v27.0.0-alpha.0.0.0', true],
['v28.0.0-alpha.0.0.0', true],
['v27.0.0-rc.0', true],
['v26.0.0-alpha.0', false],
['v23.0.0-alpha.0', false],
]) {
await t.test(version, async t => {
const { cli, logs } = await cliMock(t, {
globals: {
'process.argv': ['node', 'npm', '--version'],
'process.version': version,
},
})
await cli(process)
if (supported) {
t.strictSame(logs.warn, [])
} else {
t.match(logs.warn[0], `does not support Node.js ${version}.`)
}
})
}
})

t.test('non-ascii dash', async t => {
const { cli, logs } = await cliMock(t, {
globals: {
Expand Down
Loading