File tree 2 files changed +9
-25
lines changed
2 files changed +9
-25
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,8 @@ const BaseCommand = require('../base-command.js')
2
2
3
3
class Birthday extends BaseCommand {
4
4
async exec ( ) {
5
- this . npm . config . set ( 'package' , [ '@npmcli/npm-birthday' ] )
6
5
this . npm . config . set ( 'yes' , true )
7
- const exec = await this . npm . cmd ( 'exec' )
8
- return exec . exec ( [ 'npm-birthday' ] )
6
+ return this . npm . exec ( 'exec' , [ '@npmcli/npm-birthday' ] )
9
7
}
10
8
}
11
9
Original file line number Diff line number Diff line change 1
1
const t = require ( 'tap' )
2
- const { fake : mockNpm } = require ( '../../fixtures/mock-npm' )
2
+ const { real : mockNpm } = require ( '../../fixtures/mock-npm' )
3
3
4
4
t . test ( 'birthday' , async t => {
5
- t . plan ( 4 )
6
- const config = {
7
- yes : false ,
8
- package : [ ] ,
9
- }
10
- const npm = mockNpm ( {
11
- config,
12
- cmd : async ( cmd ) => {
13
- t . ok ( cmd , 'exec' , 'calls out to exec command' )
14
- return {
15
- exec : async ( args ) => {
16
- t . equal ( npm . config . get ( 'yes' ) , true , 'should say yes' )
17
- t . strictSame ( npm . config . get ( 'package' ) , [ '@npmcli/npm-birthday' ] ,
18
- 'uses correct package' )
19
- t . strictSame ( args , [ 'npm-birthday' ] , 'called with correct args' )
20
- } ,
21
- }
5
+ t . plan ( 2 )
6
+ const { Npm } = mockNpm ( t , {
7
+ libnpmexec : ( { args, yes } ) => {
8
+ t . ok ( yes )
9
+ t . match ( args , [ '@npmcli/npm-birthday' ] )
22
10
} ,
23
11
} )
24
- const Birthday = require ( '../../../lib/commands/birthday.js' )
25
- const birthday = new Birthday ( npm )
26
-
27
- await birthday . exec ( [ ] )
12
+ const npm = new Npm ( )
13
+ await npm . exec ( 'birthday' , [ ] )
28
14
} )
You can’t perform that action at this time.
0 commit comments