From 96cabf4cb4675aeb41c92cf1a0b721c62ee1b74a Mon Sep 17 00:00:00 2001 From: Raine Revere Date: Mon, 22 Feb 2021 11:54:05 -0700 Subject: [PATCH] Pass options.deprecated through to queryVersions. Fixes #832. --- lib/versionmanager.js | 1 + test/index.test.js | 29 +++++++++++++++++++++++++++++ test/package-managers/npm/index.js | 10 ---------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/lib/versionmanager.js b/lib/versionmanager.js index d9b09176..528eff19 100644 --- a/lib/versionmanager.js +++ b/lib/versionmanager.js @@ -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, diff --git a/test/index.test.js b/test/index.test.js index 07a525c0..206f5d67 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -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 () => { diff --git a/test/package-managers/npm/index.js b/test/package-managers/npm/index.js index f797c7dd..d1b68c5c 100644 --- a/test/package-managers/npm/index.js +++ b/test/package-managers/npm/index.js @@ -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')