describe('utils', () => { describe('hoistBaseFlags', () => { let MockCommand; beforeEach(() => { MockCommand = class extends GasketCommand {}; }); it('hoists flags from base GasketCommand', async () => { const results = hoistBaseFlags(MockCommand); assume(results).property('flags'); assume(results.flags).deep.equals(GasketCommand.flags); }); it('retains flags set on extended class', async () => { const extraFlags = { bogus: flags.string({ description: 'A bogus flag' }) }; MockCommand.flags = extraFlags; const results = hoistBaseFlags(MockCommand); assume(results.flags).deep.equals({ ...GasketCommand.flags, ...extraFlags }); }); }); });
async customLogs(text, cb) { const {cli} = require('cli-ux') const showLogs = this.debug const log = this.log const error = this.error if (!showLogs) { cli.action.start(text) } else { log(text) } return new Promise(async (resolve, reject) => { await cb(resolve, reject, showLogs) }).then(result => { if (!showLogs) { cli.action.stop(result.done) } else { log('---') } return result.code },(result) => { cli.action.stop('-') error(result.done,{exit:result.code}) }) }