1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | const {cli: defaultCli} = require('../index.js');
|
7 | exports.cli = defaultCli;
|
8 | const {expect, fancy} = require('fancy-test');
|
9 | exports.expect = expect;
|
10 | exports.test = fancy.register('cli', function cli(args, cli = defaultCli) {
|
11 | return {
|
12 | async init(ctx){
|
13 |
|
14 | if( args === undefined )
|
15 | args = [];
|
16 | else if( ! Array.isArray(args) )
|
17 | args = [args];
|
18 |
|
19 | ctx.args = args;
|
20 |
|
21 |
|
22 | if( ! ctx.expectation )
|
23 | ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`;
|
24 | },
|
25 | async run(ctx) {
|
26 | await cli.run('ds', ctx.args);
|
27 | }
|
28 | };
|
29 | });
|
30 |
|
31 |
|