Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commitlint/cli

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/cli - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

fixtures/husky/integration/package.json

47

CHANGELOG.md

@@ -6,2 +6,12 @@ # Change Log

<a name="3.1.3"></a>
## 3.1.3 (2017-08-21)
### Bug Fixes
* **core:** determine git root correctly in sub directories ([#64](https://github.com/marionebl/commitlint/issues/64)) ([d594ec4](https://github.com/marionebl/commitlint/commit/d594ec4)), closes [#62](https://github.com/marionebl/commitlint/issues/62)
<a name="3.1.2"></a>

@@ -44,2 +54,12 @@ ## 3.1.2 (2017-08-07)

<a name="3.1.2"></a>
## 3.1.2 (2017-08-07)
<a name="3.1.1"></a>
## 3.1.1 (2017-08-07)
<a name="3.0.4"></a>

@@ -72,2 +92,12 @@ ## 3.0.4 (2017-08-04)

<a name="3.0.4"></a>
## 3.0.4 (2017-08-04)
### Bug Fixes
* **core:** correct type validation message ([09c2b26](https://github.com/marionebl/commitlint/commit/09c2b26))
<a name="3.0.3"></a>

@@ -90,2 +120,7 @@ ## 3.0.3 (2017-07-16)

<a name="3.0.3"></a>
## 3.0.3 (2017-07-16)
<a name="3.0.2"></a>

@@ -103,2 +138,14 @@ ## 3.0.2 (2017-07-11)

<a name="3.0.2"></a>
## 3.0.2 (2017-07-11)
### Bug Fixes
* **cli:** remove destructuring for node 4 support ([fe8caff](https://github.com/marionebl/commitlint/commit/fe8caff))
* ensure node4 compat ([bfeb653](https://github.com/marionebl/commitlint/commit/bfeb653))
<a name="3.0.1"></a>

@@ -105,0 +152,0 @@ ## 3.0.1 (2017-07-11)

100

cli.test.js
import path from 'path';
import test from 'ava';
import execa from 'execa';
import {sync as bin} from 'resolve-bin';
import * as sander from 'sander';
import stream from 'string-to-stream';
import tmp from 'tmp';
const here = path.join.bind(null, __dirname);
const fix = here.bind(null, 'fixtures');
const SIMPLE = here('fixtures/simple');
const EXTENDS_ROOT = here('fixtures/extends-root');
const EMPTY = here('fixtures/empty');
const CLI = here('cli.js');
const SIMPLE = fix('simple');
const EXTENDS_ROOT = fix('extends-root');
const EMPTY = fix('empty');
const cli = (input = '', args = [], opts = {}) => {
const c = execa(here('cli.js'), args, {
capture: ['stdout'],
cwd: opts.cwd
});
stream(input).pipe(c.stdin);
return c;
const HUSKY = tmp.dirSync().name;
const HUSKY_INTEGRATION = path.join(tmp.dirSync().name, 'integration');
const exec = (command, args = [], opts = {}) => {
return async (input = '') => {
const c = execa(command, args, {
capture: ['stdout'],
cwd: opts.cwd
});
stream(input).pipe(c.stdin);
const result = await c;
if (result.code !== 0) {
console.log(result.stderr);
}
return result;
}
};
const cli = exec.bind(null, CLI);
const git = exec.bind(null, 'git');
const mkdir = exec.bind(null, bin('mkdirp'));
const npm = exec.bind(null, 'npm');
const rm = exec.bind(null, bin('rimraf'));
test('should throw when called without [input]', t => {
t.throws(cli(), /Expected a raw commit/);
t.throws(cli()(), /Expected a raw commit/);
});
test('should reprint input from stdin', async t => {
const actual = await cli('foo: bar', [], {cwd: EMPTY});
const actual = await cli([], {cwd: EMPTY})('foo: bar');
t.true(actual.stdout.includes('foo: bar'));

@@ -31,3 +51,3 @@ });

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

@@ -38,3 +58,3 @@ t.is(actual.stderr, '');

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

@@ -45,3 +65,3 @@ t.is(actual.stderr, '');

test('should succeed for input from stdin without rules', async t => {
const actual = await cli('foo: bar', [], {cwd: EMPTY});
const actual = await cli([], {cwd: EMPTY})('foo: bar');
t.is(actual.code, 0);

@@ -51,3 +71,3 @@ });

test('should fail for input from stdin with rule from rc', async t => {
const actual = await t.throws(cli('foo: bar', [], {cwd: SIMPLE}));
const actual = await t.throws(cli([], {cwd: SIMPLE})('foo: bar'));
t.true(actual.stdout.includes('type must not be one of [foo]'));

@@ -59,3 +79,3 @@ t.is(actual.code, 1);

const actual = await t.throws(
cli('foo: bar', ['--extends', './extended'], {cwd: EXTENDS_ROOT})
cli(['--extends', './extended'], {cwd: EXTENDS_ROOT})('foo: bar')
);

@@ -67,3 +87,3 @@ t.true(actual.stdout.includes('type must not be one of [foo]'));

test('should produce no error output with --quiet flag', async t => {
const actual = await t.throws(cli('foo: bar', ['--quiet'], {cwd: SIMPLE}));
const actual = await t.throws(cli(['--quiet'], {cwd: SIMPLE})('foo: bar'));
t.is(actual.stdout, '');

@@ -75,3 +95,3 @@ t.is(actual.stderr, '');

test('should produce no error output with -q flag', async t => {
const actual = await t.throws(cli('foo: bar', ['-q'], {cwd: SIMPLE}));
const actual = await t.throws(cli(['-q'], {cwd: SIMPLE})('foo: bar'));
t.is(actual.stdout, '');

@@ -81,1 +101,43 @@ t.is(actual.stderr, '');

});
test('should work with husky commitmsg hook', async () => {
const cwd = HUSKY;
await init(cwd);
await pkg(cwd);
await npm(['install', 'husky'], {cwd})();
await git(['add', 'package.json'], {cwd})();
await git(['commit', '-m', '"chore: this should work"'], {cwd})();
await rm([HUSKY])();
});
test('should work with husky commitmsg hook in sub packages', async () => {
const cwd = HUSKY_INTEGRATION;
const upper = path.dirname(HUSKY_INTEGRATION);
await mkdir([cwd])();
await init(upper);
await pkg(cwd);
await npm(['install', 'husky'], {cwd})();
await git(['add', 'package.json'], {cwd})();
await git(['commit', '-m', '"chore: this should work"'], {cwd})();
await rm([upper])();
});
async function init(cwd) {
await git(['init'], {cwd})();
return Promise.all([
git(['config', 'user.email', '"commitlint@gitub.com"'], {cwd})(),
git(['config', 'user.name', '"commitlint"'], {cwd})()
]);
}
function pkg(cwd) {
return sander.writeFile(cwd, 'package.json', JSON.stringify({scripts: {commitmsg: `${CLI} -e`}}));
}

9

package.json
{
"name": "@commitlint/cli",
"version": "3.1.2",
"version": "3.1.3",
"description": "Lint your commit messages",

@@ -47,7 +47,12 @@ "bin": {

"execa": "^0.7.0",
"mkdirp": "^0.5.1",
"resolve-bin": "^0.4.0",
"rimraf": "^2.6.1",
"sander": "^0.6.0",
"string-to-stream": "^1.1.0",
"tmp": "0.0.33",
"xo": "^0.18.2"
},
"dependencies": {
"@commitlint/core": "^3.1.2",
"@commitlint/core": "^3.1.3",
"babel-polyfill": "^6.23.0",

@@ -54,0 +59,0 @@ "chalk": "^2.0.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc