UNPKG

755 BJavaScriptView Raw
1/*
2 * Copyright (C) 2019 Forward Thinking, Inc. - All Rights Reserved
3 * Unauthorized copying of this file, via any medium is strictly prohibited
4 * Proprietary and confidential
5 */
6const {cli: defaultCli} = require('../index.js');
7exports.cli = defaultCli;
8const {expect, fancy} = require('fancy-test');
9exports.expect = expect;
10exports.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 //Used to auto name the tests
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