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

@commitlint/parse

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commitlint/parse - npm Package Compare versions

Comparing version 6.1.3 to 7.0.0

10

lib/index.js

@@ -18,7 +18,5 @@ 'use strict';

function parse(message) {
var $args = arguments;return new Promise(function ($return, $error) {
var parser, parserOpts, changelogOpts, parsed;
parser = $args.length > 1 && $args[1] !== undefined ? $args[1] : _conventionalCommitsParser.sync;
parserOpts = $args[2];
function parse(message, parser = _conventionalCommitsParser.sync, parserOpts) {
return new Promise(function ($return, $error) {
var changelogOpts, parsed;

@@ -29,2 +27,3 @@ if (!parserOpts || Object.keys(parserOpts || {}).length === 0) {

changelogOpts = $await_2;
parserOpts = changelogOpts.parserOpts;

@@ -40,2 +39,3 @@ return $If_1.call(this);

parsed = parser(message, parserOpts);
parsed.raw = message;

@@ -42,0 +42,0 @@ return $return(parsed);

@@ -21,334 +21,302 @@ 'use strict';

(0, _ava2.default)('throws when called without params', function (t) {
return new Promise(function ($return, $error) {
var error;
return Promise.resolve(t.throws((0, _2.default)())).then(function ($await_1) {
try {
error = $await_1;
t.is(error.message, 'Expected a raw commit');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('throws when called without params', t => new Promise(function ($return, $error) {
var error;
return Promise.resolve(t.throws((0, _2.default)())).then(function ($await_1) {
try {
error = $await_1;
(0, _ava2.default)('throws when called with empty message', function (t) {
return new Promise(function ($return, $error) {
var error;
return Promise.resolve(t.throws((0, _2.default)())).then(function ($await_2) {
try {
error = $await_2;
t.is(error.message, 'Expected a raw commit');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(error.message, 'Expected a raw commit');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('returns object with raw message', function (t) {
return new Promise(function ($return, $error) {
var message, actual;
(0, _ava2.default)('throws when called with empty message', t => new Promise(function ($return, $error) {
var error;
return Promise.resolve(t.throws((0, _2.default)())).then(function ($await_2) {
try {
error = $await_2;
message = 'type(scope): subject';
return Promise.resolve((0, _2.default)(message)).then(function ($await_3) {
try {
actual = $await_3;
t.is(actual.raw, message);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(error.message, 'Expected a raw commit');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('calls parser with message and passed options', function (t) {
return new Promise(function ($return, $error) {
var message;
(0, _ava2.default)('returns object with raw message', t => new Promise(function ($return, $error) {
var message, actual;
message = 'type(scope): subject';
return Promise.resolve((0, _2.default)(message)).then(function ($await_3) {
try {
actual = $await_3;
message = 'message';
t.is(actual.raw, message);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
return Promise.resolve((0, _2.default)(message, function (m) {
t.is(message, m);
return {};
})).then(function ($await_4) {
try {
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
(0, _ava2.default)('calls parser with message and passed options', t => new Promise(function ($return, $error) {
var message;
message = 'message';
return Promise.resolve((0, _2.default)(message, m => {
t.is(message, m);
return {};
})).then(function ($await_4) {
try {
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('passes object up from parser function', function (t) {
return new Promise(function ($return, $error) {
var message, result, actual;
(0, _ava2.default)('passes object up from parser function', t => new Promise(function ($return, $error) {
var message, result, actual;
message = 'message';
result = {};
return Promise.resolve((0, _2.default)(message, () => result)).then(function ($await_5) {
try {
actual = $await_5;
message = 'message';
result = {};
return Promise.resolve((0, _2.default)(message, function () {
return result;
})).then(function ($await_5) {
try {
actual = $await_5;
t.is(actual, result);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(actual, result);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('returns object with expected keys', function (t) {
return new Promise(function ($return, $error) {
var message, actual, expected;
(0, _ava2.default)('returns object with expected keys', t => new Promise(function ($return, $error) {
var message, actual, expected;
message = 'message';
return Promise.resolve((0, _2.default)(message)).then(function ($await_6) {
try {
actual = $await_6;
expected = {
body: null,
footer: null,
header: 'message',
mentions: [],
merge: null,
notes: [],
raw: 'message',
references: [],
revert: null,
scope: null,
subject: null,
type: null
};
message = 'message';
return Promise.resolve((0, _2.default)(message)).then(function ($await_6) {
try {
actual = $await_6;
expected = {
body: null,
footer: null,
header: 'message',
mentions: [],
merge: null,
notes: [],
raw: 'message',
references: [],
revert: null,
scope: null,
subject: null,
type: null
};
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('uses angular grammar', function (t) {
return new Promise(function ($return, $error) {
var message, actual, expected;
(0, _ava2.default)('uses angular grammar', t => new Promise(function ($return, $error) {
var message, actual, expected;
message = 'type(scope): subject';
return Promise.resolve((0, _2.default)(message)).then(function ($await_7) {
try {
actual = $await_7;
expected = {
body: null,
footer: null,
header: 'type(scope): subject',
mentions: [],
merge: null,
notes: [],
raw: 'type(scope): subject',
references: [],
revert: null,
scope: 'scope',
subject: 'subject',
type: 'type'
};
message = 'type(scope): subject';
return Promise.resolve((0, _2.default)(message)).then(function ($await_7) {
try {
actual = $await_7;
expected = {
body: null,
footer: null,
header: 'type(scope): subject',
mentions: [],
merge: null,
notes: [],
raw: 'type(scope): subject',
references: [],
revert: null,
scope: 'scope',
subject: 'subject',
type: 'type'
};
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('uses custom opts parser', function (t) {
return new Promise(function ($return, $error) {
var message, changelogOpts, actual, expected;
(0, _ava2.default)('uses custom opts parser', t => new Promise(function ($return, $error) {
var message, changelogOpts, actual, expected;
message = 'type(scope)-subject';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), './fixtures/parser-preset/conventional-changelog-custom')).then(function ($await_8) {
try {
changelogOpts = $await_8;
return Promise.resolve((0, _2.default)(message, undefined, changelogOpts.parserOpts)).then(function ($await_9) {
try {
actual = $await_9;
expected = {
body: null,
footer: null,
header: 'type(scope)-subject',
mentions: [],
merge: null,
notes: [],
raw: 'type(scope)-subject',
references: [],
revert: null,
scope: 'scope',
subject: 'subject',
type: 'type'
};
message = 'type(scope)-subject';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), './fixtures/parser-preset/conventional-changelog-custom')).then(function ($await_8) {
try {
changelogOpts = $await_8;
return Promise.resolve((0, _2.default)(message, undefined, changelogOpts.parserOpts)).then(function ($await_9) {
try {
actual = $await_9;
expected = {
body: null,
footer: null,
header: 'type(scope)-subject',
mentions: [],
merge: null,
notes: [],
raw: 'type(scope)-subject',
references: [],
revert: null,
scope: 'scope',
subject: 'subject',
type: 'type'
};
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.deepEqual(actual, expected);
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('supports scopes with /', function (t) {
return new Promise(function ($return, $error) {
var message, actual;
(0, _ava2.default)('supports scopes with /', t => new Promise(function ($return, $error) {
var message, actual;
message = 'type(some/scope): subject';
return Promise.resolve((0, _2.default)(message)).then(function ($await_10) {
try {
actual = $await_10;
message = 'type(some/scope): subject';
return Promise.resolve((0, _2.default)(message)).then(function ($await_10) {
try {
actual = $await_10;
t.is(actual.scope, 'some/scope');
t.is(actual.subject, 'subject');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(actual.scope, 'some/scope');
t.is(actual.subject, 'subject');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('supports scopes with / and empty parserOpts', function (t) {
return new Promise(function ($return, $error) {
var message, actual;
(0, _ava2.default)('supports scopes with / and empty parserOpts', t => new Promise(function ($return, $error) {
var message, actual;
message = 'type(some/scope): subject';
return Promise.resolve((0, _2.default)(message, undefined, {})).then(function ($await_11) {
try {
actual = $await_11;
message = 'type(some/scope): subject';
return Promise.resolve((0, _2.default)(message, undefined, {})).then(function ($await_11) {
try {
actual = $await_11;
t.is(actual.scope, 'some/scope');
t.is(actual.subject, 'subject');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(actual.scope, 'some/scope');
t.is(actual.subject, 'subject');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('ignores comments', function (t) {
return new Promise(function ($return, $error) {
var message, changelogOpts, opts, actual;
(0, _ava2.default)('ignores comments', t => new Promise(function ($return, $error) {
var message, changelogOpts, opts, actual;
message = 'type(some/scope): subject\n# some comment';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), 'conventional-changelog-angular')).then(function ($await_12) {
try {
changelogOpts = $await_12;
opts = Object.assign({}, changelogOpts.parserOpts, { commentChar: '#' });
return Promise.resolve((0, _2.default)(message, undefined, opts)).then(function ($await_13) {
try {
actual = $await_13;
message = 'type(some/scope): subject\n# some comment';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), 'conventional-changelog-angular')).then(function ($await_12) {
try {
changelogOpts = $await_12;
opts = Object.assign({}, changelogOpts.parserOpts, { commentChar: '#' });
return Promise.resolve((0, _2.default)(message, undefined, opts)).then(function ($await_13) {
try {
actual = $await_13;
t.is(actual.body, null);
t.is(actual.footer, null);
t.is(actual.subject, 'subject');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(actual.body, null);
t.is(actual.footer, null);
t.is(actual.subject, 'subject');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('registers inline #', function (t) {
return new Promise(function ($return, $error) {
var message, changelogOpts, opts, actual;
(0, _ava2.default)('registers inline #', t => new Promise(function ($return, $error) {
var message, changelogOpts, opts, actual;
message = 'type(some/scope): subject #reference\n# some comment\nthings #reference';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), 'conventional-changelog-angular')).then(function ($await_14) {
try {
changelogOpts = $await_14;
opts = Object.assign({}, changelogOpts.parserOpts, { commentChar: '#' });
return Promise.resolve((0, _2.default)(message, undefined, opts)).then(function ($await_15) {
try {
actual = $await_15;
message = 'type(some/scope): subject #reference\n# some comment\nthings #reference';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), 'conventional-changelog-angular')).then(function ($await_14) {
try {
changelogOpts = $await_14;
opts = Object.assign({}, changelogOpts.parserOpts, { commentChar: '#' });
return Promise.resolve((0, _2.default)(message, undefined, opts)).then(function ($await_15) {
try {
actual = $await_15;
t.is(actual.subject, 'subject #reference');
t.is(actual.body, 'things #reference');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(actual.subject, 'subject #reference');
t.is(actual.body, 'things #reference');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('parses references leading subject', function (t) {
return new Promise(function ($return, $error) {
var message, opts, _ref, _ref$references, actual;
(0, _ava2.default)('parses references leading subject', t => new Promise(function ($return, $error) {
var message, opts, _ref, _ref$references, actual;
message = '#1 some subject';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), 'conventional-changelog-angular')).then(function ($await_16) {
try {
opts = $await_16;
return Promise.resolve((0, _2.default)(message, undefined, opts)).then(function ($await_17) {
try {
_ref = $await_17, _ref$references = (0, _slicedToArray3.default)(_ref.references, 1), actual = _ref$references[0];
message = '#1 some subject';
return Promise.resolve((0, _importFrom2.default)(process.cwd(), 'conventional-changelog-angular')).then(function ($await_16) {
try {
opts = $await_16;
return Promise.resolve((0, _2.default)(message, undefined, opts)).then(function ($await_17) {
try {
_ref = $await_17, _ref$references = (0, _slicedToArray3.default)(_ref.references, 1);
actual = _ref$references[0];
t.is(actual.issue, '1');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.is(actual.issue, '1');
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
(0, _ava2.default)('parses custom references', function (t) {
return new Promise(function ($return, $error) {
var message, _ref2, references;
(0, _ava2.default)('parses custom references', t => new Promise(function ($return, $error) {
var message, _ref2, references;
message = '#1 some subject PREFIX-2';
return Promise.resolve((0, _2.default)(message, undefined, {
issuePrefixes: ['PREFIX-']
})).then(function ($await_18) {
try {
_ref2 = $await_18, references = _ref2.references;
message = '#1 some subject PREFIX-2';
return Promise.resolve((0, _2.default)(message, undefined, {
issuePrefixes: ['PREFIX-']
})).then(function ($await_18) {
try {
_ref2 = $await_18;
references = _ref2.references;
t.falsy(references.find(function (ref) {
return ref.issue === '1';
}));
t.deepEqual(references.find(function (ref) {
return ref.issue === '2';
}), {
action: null,
issue: '2',
owner: null,
prefix: 'PREFIX-',
raw: '#1 some subject PREFIX-2',
repository: null
});
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this));
});
t.falsy(references.find(ref => ref.issue === '1'));
t.deepEqual(references.find(ref => ref.issue === '2'), {
action: null,
issue: '2',
owner: null,
prefix: 'PREFIX-',
raw: '#1 some subject PREFIX-2',
repository: null
});
return $return();
} catch ($boundEx) {
return $error($boundEx);
}
}.bind(this), $error);
}.bind(this)));
//# sourceMappingURL=index.test.js.map
{
"name": "@commitlint/parse",
"version": "6.1.3",
"version": "7.0.0",
"description": "Lint your commit messages",

@@ -62,7 +62,7 @@ "main": "lib/index.js",

"devDependencies": {
"@commitlint/test": "^6.1.3",
"@commitlint/utils": "^6.1.3",
"@commitlint/test": "^7.0.0",
"@commitlint/utils": "^7.0.0",
"ava": "0.22.0",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^6.1.3",
"babel-preset-commitlint": "^7.0.0",
"babel-register": "6.26.0",

@@ -69,0 +69,0 @@ "concurrently": "3.5.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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