2020-01-15 04:58:28 +09:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const path = require('path');
|
|
|
|
const { execCommand } = require('cli-testlab');
|
|
|
|
|
|
|
|
const KNEX = path.normalize(__dirname + '/../../bin/cli.js');
|
|
|
|
|
|
|
|
describe('help', () => {
|
|
|
|
it('Prints help', () => {
|
|
|
|
return execCommand(`node ${KNEX} --help`, {
|
2020-10-29 22:41:59 +01:00
|
|
|
expectedOutput: { expectedText: 'Usage', exactlyTimes: 1 },
|
2020-01-15 04:58:28 +09:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Prints help using -h flag', () => {
|
|
|
|
return execCommand(`node ${KNEX} -h`, {
|
2020-10-29 22:41:59 +01:00
|
|
|
expectedOutput: { expectedText: 'Usage', exactlyTimes: 1 },
|
2020-01-15 04:58:28 +09:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Prints help when no arguments are given', () => {
|
|
|
|
return execCommand(`node ${KNEX}`, {
|
2021-01-17 20:28:39 +02:00
|
|
|
expectedErrorMessage: 'Usage: cli [options] [command]',
|
2020-01-15 04:58:28 +09:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Does not print help when argument is given', () => {
|
|
|
|
return execCommand(`node ${KNEX} -V`, {
|
|
|
|
notExpectedOutput: 'Usage',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|