Skip to content

Commit

Permalink
Pass options.deprecated through to queryVersions. Fixes #832.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Feb 22, 2021
1 parent 2c8df26 commit 96cabf4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
1 change: 1 addition & 0 deletions lib/versionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ async function getOwnerPerDependency(fromVersion, toVersion, options) {
async function upgradePackageDefinitions(currentDependencies, options) {
const latestVersions = await queryVersions(currentDependencies, {
concurrency: options.concurrency,
deprecated: options.deprecated,
enginesNode: options.enginesNode,
json: options.json,
loglevel: options.loglevel,
Expand Down
29 changes: 29 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,35 @@ describe('run', function () {
})
})

describe('deprecated', () => {

it('deprecated excluded by default', async () => {
const upgrades = await ncu.run({
packageData: JSON.stringify({
dependencies: {
'ncu-test-deprecated': '1.0.0'
}
})
})
upgrades.should.deep.equal({})
})

it('deprecated included with option', async () => {
const upgrades = await ncu.run({
deprecated: true,
packageData: JSON.stringify({
dependencies: {
'ncu-test-deprecated': '1.0.0'
}
})
})
upgrades.should.deep.equal({
'ncu-test-deprecated': '2.0.0'
})
})

})

describe('target', () => {

it('do not allow --greatest and --newest together', async () => {
Expand Down
10 changes: 0 additions & 10 deletions test/package-managers/npm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ describe('npm', function () {
parseInt(version, 10).should.be.above(1)
})

it('deprecated excluded by default', async () => {
const latest = await packageManagers.npm.latest('ncu-test-deprecated', null, { cwd: __dirname })
latest.should.equal('1.0.0')
})

it('deprecated included with option', async () => {
const latest = await packageManagers.npm.latest('ncu-test-deprecated', null, { deprecated: true, cwd: __dirname })
latest.should.equal('2.0.0')
})

it('greatest', async () => {
const version = await packageManagers.npm.greatest('ncu-test-greatest-not-newest', null, { pre: true, cwd: __dirname })
version.should.equal('2.0.0-beta')
Expand Down

0 comments on commit 96cabf4

Please sign in to comment.