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 bin/semver.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const main = () => {
versions = versions.map((v) => {
return coerce ? (semver.coerce(v, options) || { version: v }).version : v
}).filter((v) => {
return semver.valid(v)
return semver.valid(v, options)
})
if (!versions.length) {
return fail()
Expand Down
18 changes: 16 additions & 2 deletions tap-snapshots/test/bin/semver.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ Object {
}
`

exports[`test/bin/semver.js TAP inc tests > -i release 1.0.0-pre`] = `
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be deleted. There was a test missing in #753 (see below).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Added the missing test ['-i', 'release', '1.0.0-pre'] which restores this snapshot.

exports[`test/bin/semver.js TAP inc tests > -i release 1.0.0-pre 1`] = `
Object {
"code": 0,
"err": "",
Expand Down Expand Up @@ -454,11 +454,24 @@ Object {
}
`

exports[`test/bin/semver.js TAP sorting and filtering > 1.2.3beta -l 1`] = `
Object {
"code": 0,
"err": "",
"out": "1.2.3-beta\\n",
"signal": null,
}
`

exports[`test/bin/semver.js TAP sorting and filtering > 1.2.3foo 1.2.3-bar -l 1`] = `
Object {
"code": 0,
"err": "",
"out": "1.2.3-bar\\n",
"out": String(
1.2.3-bar
1.2.3-foo

),
"signal": null,
}
`
Expand All @@ -477,6 +490,7 @@ Object {
"code": 0,
"err": "",
"out": String(
2.0.0-asdf
2.3.4-beta
2.3.4

Expand Down
2 changes: 2 additions & 0 deletions test/bin/semver.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ t.test('inc tests', t => Promise.all([
['-i', 'premajor', '1.0.0', '--preid=beta', '-n', '1'],
['-i', 'premajor', '1.0.0', '--preid=beta', '-n', 'false'],
['-i', '1.2.3'],
['-i', 'release', '1.0.0-pre'],
].map(args => t.resolveMatchSnapshot(run(args), args.join(' ')))))

t.test('help output', t => Promise.all([
Expand All @@ -49,6 +50,7 @@ t.test('sorting and filtering', t => Promise.all([
['1.2.3', '-v', '3.2.1', '--version', '2.3.4', '-rv'],
['1.2.3foo', '1.2.3-bar'],
['1.2.3foo', '1.2.3-bar', '-l'],
['1.2.3beta', '-l'],
['1.2.3', '3.2.1', '-r', '2.x', '2.3.4'],
['1.2.3', '3.2.1', '2.3.4', '2.3.4-beta', '2.0.0asdf', '-r', '2.x'],
['1.2.3', '3.2.1', '2.3.4', '2.3.4-beta', '2.0.0asdf', '-r', '2.x', '-p'],
Expand Down
Loading