-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dry-run to deprecate/undeprecate commands
- Loading branch information
Showing
2 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ t.test('deprecates given range', async t => { | |
}) | ||
|
||
t.test('deprecates all versions when no range is specified', async t => { | ||
const { npm, joinedOutput } = await loadMockNpm(t, { config: { ...auth } }) | ||
const { npm, logs, joinedOutput } = await loadMockNpm(t, { config: { ...auth } }) | ||
const registry = new MockRegistry({ | ||
tap: t, | ||
registry: npm.config.get('registry'), | ||
|
@@ -151,6 +151,37 @@ t.test('deprecates all versions when no range is specified', async t => { | |
}).reply(200, {}) | ||
|
||
await npm.exec('deprecate', ['foo', message]) | ||
t.match(logs.notice, [ | ||
`deprecating [email protected] with message "${message}"`, | ||
`deprecating [email protected] with message "${message}"`, | ||
`deprecating [email protected] with message "${message}"`, | ||
]) | ||
t.match(joinedOutput(), '') | ||
}) | ||
|
||
t.test('dry-run', async t => { | ||
const { npm, logs, joinedOutput } = await loadMockNpm(t, { config: { | ||
'dry-run': true, | ||
...auth, | ||
} }) | ||
const registry = new MockRegistry({ | ||
tap: t, | ||
registry: npm.config.get('registry'), | ||
authorization: token, | ||
}) | ||
const manifest = registry.manifest({ | ||
name: 'foo', | ||
versions, | ||
}) | ||
await registry.package({ manifest, query: { write: true } }) | ||
const message = 'test deprecation message' | ||
|
||
await npm.exec('deprecate', ['foo', message]) | ||
t.match(logs.notice, [ | ||
`deprecating [email protected] with message "${message}"`, | ||
`deprecating [email protected] with message "${message}"`, | ||
`deprecating [email protected] with message "${message}"`, | ||
]) | ||
t.match(joinedOutput(), '') | ||
}) | ||
|
||
|