@@ -16,50 +16,50 @@ class Command extends Base {
16
16
17
17
describe ( 'command' , ( ) => {
18
18
fancy
19
- . stdout ( )
20
- . do ( ( ) => Command . run ( [ ] ) )
21
- . do ( output => expect ( output . stdout ) . to . equal ( 'foo\n' ) )
22
- . it ( 'logs to stdout' )
19
+ . stdout ( )
20
+ . do ( ( ) => Command . run ( [ ] ) )
21
+ . do ( output => expect ( output . stdout ) . to . equal ( 'foo\n' ) )
22
+ . it ( 'logs to stdout' )
23
23
24
24
fancy
25
- . do ( async ( ) => {
26
- class Command extends Base {
27
- static description = 'test command'
25
+ . do ( async ( ) => {
26
+ class Command extends Base {
27
+ static description = 'test command'
28
28
29
- async run ( ) {
30
- return 101
29
+ async run ( ) {
30
+ return 101
31
+ }
31
32
}
32
- }
33
33
34
- expect ( await Command . run ( [ ] ) ) . to . equal ( 101 )
35
- } )
36
- . it ( 'returns value' )
34
+ expect ( await Command . run ( [ ] ) ) . to . equal ( 101 )
35
+ } )
36
+ . it ( 'returns value' )
37
37
38
38
fancy
39
- . do ( ( ) => {
40
- class Command extends Base {
41
- async run ( ) {
42
- throw new Error ( 'new x error' )
39
+ . do ( ( ) => {
40
+ class Command extends Base {
41
+ async run ( ) {
42
+ throw new Error ( 'new x error' )
43
+ }
43
44
}
44
- }
45
45
46
- return Command . run ( [ ] )
47
- } )
48
- . catch ( / n e w x e r r o r / )
49
- . it ( 'errors out' )
46
+ return Command . run ( [ ] )
47
+ } )
48
+ . catch ( / n e w x e r r o r / )
49
+ . it ( 'errors out' )
50
50
51
51
fancy
52
- . stdout ( )
53
- . do ( ( ) => {
54
- class Command extends Base {
55
- async run ( ) {
56
- this . exit ( 0 )
52
+ . stdout ( )
53
+ . do ( ( ) => {
54
+ class Command extends Base {
55
+ async run ( ) {
56
+ this . exit ( 0 )
57
+ }
57
58
}
58
- }
59
- return Command . run ( [ ] )
60
- } )
61
- . catch ( / E E X I T : 0 / )
62
- . it ( 'exits with 0' )
59
+ return Command . run ( [ ] )
60
+ } )
61
+ . catch ( / E E X I T : 0 / )
62
+ . it ( 'exits with 0' )
63
63
64
64
describe ( 'convertToCached' , ( ) => {
65
65
fancy
@@ -140,11 +140,11 @@ describe('command', () => {
140
140
// ],
141
141
// })
142
142
// })
143
- . it ( 'converts to cached with everything set' )
143
+ . it ( 'converts to cached with everything set' )
144
144
145
145
fancy
146
146
// .skip()
147
- . do ( async ( ) => {
147
+ . do ( async ( ) => {
148
148
// const c = class extends Command {
149
149
// }.convertToCached()
150
150
// expect(await c.load()).to.have.property('run')
@@ -162,9 +162,9 @@ describe('command', () => {
162
162
// flags: {},
163
163
// args: [],
164
164
// })
165
- } )
165
+ } )
166
166
167
- . it ( 'adds plugin name' )
167
+ . it ( 'adds plugin name' )
168
168
169
169
fancy
170
170
// .skip()
@@ -187,90 +187,90 @@ describe('command', () => {
187
187
// args: [],
188
188
// })
189
189
// })
190
- . it ( 'converts to cached with nothing set' )
190
+ . it ( 'converts to cached with nothing set' )
191
191
} )
192
192
193
193
describe ( 'parse' , ( ) => {
194
194
fancy
195
- . stdout ( )
196
- . it ( 'has a flag' , async ctx => {
197
- class CMD extends Base {
198
- static flags = {
199
- foo : flags . string ( )
200
- }
195
+ . stdout ( )
196
+ . it ( 'has a flag' , async ctx => {
197
+ class CMD extends Base {
198
+ static flags = {
199
+ foo : flags . string ( )
200
+ }
201
201
202
- async run ( ) {
203
- const { flags} = this . parse ( CMD )
204
- this . log ( flags . foo )
202
+ async run ( ) {
203
+ const { flags} = this . parse ( CMD )
204
+ this . log ( flags . foo )
205
+ }
205
206
}
206
- }
207
207
208
- await CMD . run ( [ '--foo=bar' ] )
209
- expect ( ctx . stdout ) . to . equal ( 'bar\n' )
210
- } )
208
+ await CMD . run ( [ '--foo=bar' ] )
209
+ expect ( ctx . stdout ) . to . equal ( 'bar\n' )
210
+ } )
211
211
} )
212
212
213
213
describe ( 'version' , ( ) => {
214
214
fancy
215
- . stdout ( )
216
- . add ( 'config' , ( ) => Config . load ( ) )
217
- . do ( async ( ) => {
218
- await Command . run ( [ '--version' ] )
219
- } )
220
- . catch ( / E E X I T : 0 / )
221
- . it ( 'shows version' , ctx => {
222
- expect ( ctx . stdout ) . to . equal ( `${ ctx . config . userAgent } \n` )
223
- } )
215
+ . stdout ( )
216
+ . add ( 'config' , ( ) => Config . load ( ) )
217
+ . do ( async ( ) => {
218
+ await Command . run ( [ '--version' ] )
219
+ } )
220
+ . catch ( / E E X I T : 0 / )
221
+ . it ( 'shows version' , ctx => {
222
+ expect ( ctx . stdout ) . to . equal ( `${ ctx . config . userAgent } \n` )
223
+ } )
224
224
} )
225
225
226
226
describe ( 'help' , ( ) => {
227
227
fancy
228
- . stdout ( )
229
- . do ( ( ) => {
230
- class CMD extends Command {
231
- static flags = { help : flags . help ( ) }
232
- }
233
- return CMD . run ( [ '--help' ] )
234
- } )
235
- . catch ( / E E X I T : 0 / )
236
- . it ( '--help' , ctx => {
237
- expect ( ctx . stdout ) . to . equal ( `test command
228
+ . stdout ( )
229
+ . do ( ( ) => {
230
+ class CMD extends Command {
231
+ static flags = { help : flags . help ( ) }
232
+ }
233
+ return CMD . run ( [ '--help' ] )
234
+ } )
235
+ . catch ( / E E X I T : 0 / )
236
+ . it ( '--help' , ctx => {
237
+ expect ( ctx . stdout ) . to . equal ( `test command
238
238
239
239
USAGE
240
240
$ @oclif/command
241
241
242
242
OPTIONS
243
243
--help show CLI help
244
244
` )
245
- } )
245
+ } )
246
246
247
247
fancy
248
- . stdout ( )
249
- . do ( async ( ) => {
250
- class CMD extends Command { }
251
- await CMD . run ( [ '-h' ] )
252
- } )
253
- . catch ( / E E X I T : 0 / )
254
- . it ( '-h' , ctx => {
248
+ . stdout ( )
249
+ . do ( async ( ) => {
250
+ class CMD extends Command { }
251
+ await CMD . run ( [ '-h' ] )
252
+ } )
253
+ . catch ( / E E X I T : 0 / )
254
+ . it ( '-h' , ctx => {
255
255
// expect(process.exitCode).to.equal(0)
256
- expect ( ctx . stdout ) . to . equal ( `test command
256
+ expect ( ctx . stdout ) . to . equal ( `test command
257
257
258
258
USAGE
259
259
$ @oclif/command
260
260
` )
261
- } )
261
+ } )
262
262
} )
263
263
264
264
describe ( '.log()' , ( ) => {
265
265
fancy
266
- . stdout ( )
267
- . do ( async ( ) => {
268
- class CMD extends Command {
269
- async run ( ) { this . log ( 'json output: %j' , { a : 'foobar' } ) }
270
- }
271
- await CMD . run ( [ ] )
272
- } )
273
- . do ( ctx => expect ( ctx . stdout ) . to . equal ( 'json output: {"a":"foobar"}\n' ) )
274
- . it ( 'uses util.format()' )
266
+ . stdout ( )
267
+ . do ( async ( ) => {
268
+ class CMD extends Command {
269
+ async run ( ) { this . log ( 'json output: %j' , { a : 'foobar' } ) }
270
+ }
271
+ await CMD . run ( [ ] )
272
+ } )
273
+ . do ( ctx => expect ( ctx . stdout ) . to . equal ( 'json output: {"a":"foobar"}\n' ) )
274
+ . it ( 'uses util.format()' )
275
275
} )
276
276
} )
0 commit comments