Skip to content

Commit

Permalink
Revert "fix: avoid excessive help text #606 (#637)"
Browse files Browse the repository at this point in the history
This reverts commit 8f3c3b1.
  • Loading branch information
marionebl committed May 6, 2019
1 parent 1e2e8ed commit 03da46c
Show file tree
Hide file tree
Showing 15 changed files with 352 additions and 2,234 deletions.
14 changes: 2 additions & 12 deletions @commitlint/cli/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ const flags = {
alias: 'v',
type: 'boolean',
description: 'display version information'
},
verbose: {
alias: 'V',
type: 'boolean',
description: 'enable verbose output for reports without problems'
}
};

Expand Down Expand Up @@ -209,14 +204,9 @@ async function main(options) {
}
);

const output = format(report, {
color: flags.color,
verbose: flags.verbose,
helpUrl:
'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
});
const output = format(report, {color: flags.color});

if (!flags.quiet && output !== '') {
if (!flags.quiet) {
console.log(output);
}

Expand Down
33 changes: 4 additions & 29 deletions @commitlint/cli/src/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,20 @@ test('should reprint input from stdin', async t => {
t.true(actual.stdout.includes('foo: bar'));
});

test('should produce success output with --verbose flag', async t => {
const cwd = await git.bootstrap('fixtures/default');
const actual = await cli(['--verbose'], {cwd})('type: bar');
t.true(actual.stdout.includes('0 problems, 0 warnings'));
t.is(actual.stderr, '');
});

test('should produce no output with --quiet flag', async t => {
test('should produce no success output with --quiet flag', async t => {
const cwd = await git.bootstrap('fixtures/default');
const actual = await cli(['--quiet'], {cwd})('foo: bar');
t.is(actual.stdout, '');
t.is(actual.stderr, '');
});

test('should produce no output with -q flag', async t => {
test('should produce no success output with -q flag', async t => {
const cwd = await git.bootstrap('fixtures/default');
const actual = await cli(['-q'], {cwd})('foo: bar');
t.is(actual.stdout, '');
t.is(actual.stderr, '');
});

test('should produce help for empty config', async t => {
const cwd = await git.bootstrap('fixtures/empty');
const actual = await cli([], {cwd})('foo: bar');
t.true(actual.stdout.includes('Please add rules'));
t.is(actual.code, 1);
});

test('should produce help for problems', async t => {
const cwd = await git.bootstrap('fixtures/default');
const actual = await cli([], {cwd})('foo: bar');
t.true(
actual.stdout.includes(
'Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
)
);
t.is(actual.code, 1);
});

test('should fail for input from stdin without rules', async t => {
const cwd = await git.bootstrap('fixtures/empty');
const actual = await cli([], {cwd})('foo: bar');
Expand Down Expand Up @@ -284,13 +259,13 @@ test('should print full commit message when input from stdin fails', async t =>
t.is(actual.code, 1);
});

test('should not print commit message fully or partially when input succeeds', async t => {
test('should not print full commit message when input succeeds', async t => {
const cwd = await git.bootstrap('fixtures/default');
const message = 'type: bar\n\nFoo bar bizz buzz.\n\nCloses #123.';
const actual = await cli([], {cwd})(message);

t.false(actual.stdout.includes(message));
t.false(actual.stdout.includes(message.split('\n')[0]));
t.true(actual.stdout.includes(message.split('\n')[0]));
t.is(actual.code, 0);
});

Expand Down
1 change: 0 additions & 1 deletion @commitlint/format/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion @commitlint/format/index.js

This file was deleted.

4 changes: 0 additions & 4 deletions @commitlint/format/jest.config.js

This file was deleted.

40 changes: 30 additions & 10 deletions @commitlint/format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,32 @@
"lib/"
],
"scripts": {
"build": "tsc",
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
"clean": "npx rimraf lib",
"deps": "dep-check",
"pkg": "pkg-check --skip-import",
"start": "concurrently \"yarn test --watchAll\" \"yarn run watch\"",
"test": "jest",
"watch": "tsc -w"
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
"test": "ava -c 4 --verbose",
"watch": "babel src --out-dir lib --watch --source-maps"
},
"ava": {
"files": [
"src/**/*.test.js",
"!lib/**/*"
],
"source": [
"src/**/*.js",
"!lib/**/*"
],
"babel": "inherit",
"require": [
"babel-register"
]
},
"babel": {
"presets": [
"babel-preset-commitlint"
]
},
"engines": {
"node": ">=4"
Expand All @@ -40,16 +59,17 @@
"devDependencies": {
"@commitlint/test": "7.5.0",
"@commitlint/utils": "^7.5.0",
"@types/jest": "24.0.12",
"@types/lodash": "4.14.123",
"ava": "0.22.0",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^7.5.0",
"babel-register": "6.26.0",
"concurrently": "3.5.1",
"cross-env": "5.1.1",
"jest": "24.7.1",
"rimraf": "2.6.1",
"ts-jest": "24.0.2",
"typescript": "3.4.5"
"lodash": "4.17.11",
"rimraf": "2.6.1"
},
"dependencies": {
"babel-runtime": "^6.23.0",
"chalk": "^2.0.1"
}
}
Loading

0 comments on commit 03da46c

Please sign in to comment.