Skip to content

Commit

Permalink
Make --deprecated true by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Nov 25, 2023
1 parent 0bdc595 commit d254d98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cli-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ const cliOptions: CLIOption[] = [
},
{
long: 'deprecated',
default: true,
description: 'Include deprecated packages.',
type: 'boolean',
},
Expand Down
20 changes: 17 additions & 3 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,20 @@ describe('run', function () {
})

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

it('deprecated included with option', async () => {
it('deprecated included with --deprecated', async () => {
const upgrades = await ncu({
deprecated: true,
packageData: {
Expand All @@ -160,6 +162,18 @@ describe('run', function () {
'ncu-test-deprecated': '2.0.0',
})
})

it('deprecated excluded with --no-deprecated', async () => {
const upgrades = await ncu({
deprecated: false,
packageData: {
dependencies: {
'ncu-test-deprecated': '1.0.0',
},
},
})
upgrades!.should.deep.equal({})
})
})

it('ignore non-string versions (sometimes used as comments)', async () => {
Expand Down

0 comments on commit d254d98

Please sign in to comment.