Skip to content

Commit

Permalink
feat(selection): allow manually disabling deprecation skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Oct 18, 2017
1 parent 5676658 commit 0d239d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function pickManifest (packument, wanted, opts) {
target = tagVersion
}

if (!target) {
if (!target && !opts.includeDeprecated) {
target = semver.maxSatisfying(undeprecated, wanted, true)
}
if (!target) {
Expand Down
16 changes: 16 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,19 @@ test('matches deprecated versions if we have to', t => {
t.equal(manifest.version, '1.1.0', 'picked the right manifest')
t.done()
})

test('accepts opts.includeDeprecated option to disable skipping', t => {
const metadata = {
versions: {
'1.0.0': { version: '1.0.0' },
'1.0.1': { version: '1.0.1' },
'1.1.0': { version: '1.1.0', deprecated: 'yes' },
'2.0.0': { version: '2.0.0' }
}
}
const manifest = pickManifest(metadata, '^1.0.0', {
includeDeprecated: true
})
t.equal(manifest.version, '1.1.0', 'picked the right manifest')
t.done()
})

0 comments on commit 0d239d3

Please sign in to comment.