@commitlint/is-ignored 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/lib/defaults.d.ts +3 -0
- package/lib/defaults.d.ts.map +1 -0
- package/lib/defaults.js +30 -0
- package/lib/defaults.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -31
- package/lib/index.js.map +1 -1
- package/lib/is-ignored.d.ts +7 -0
- package/lib/is-ignored.d.ts.map +1 -0
- package/lib/is-ignored.js +28 -0
- package/lib/is-ignored.js.map +1 -0
- package/package.json +9 -36
- package/lib/index.test.js +0 -123
- package/lib/index.test.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.1.0](https://github.com/conventional-changelog/commitlint/compare/v8.0.0...v8.1.0) (2019-07-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @commitlint/is-ignored
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [7.6.0](https://github.com/conventional-changelog/commitlint/compare/v7.5.2...v7.6.0) (2019-05-06)
|
|
7
15
|
|
|
8
16
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAEA,oBAAY,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;AAelD,eAAO,MAAM,SAAS,EAAE,OAAO,EAW9B,CAAC"}
|
package/lib/defaults.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
9
|
+
exports.__esModule = true;
|
|
10
|
+
var semver = __importStar(require("semver"));
|
|
11
|
+
var isSemver = function (c) {
|
|
12
|
+
var firstLine = c.split('\n').shift();
|
|
13
|
+
if (typeof firstLine !== 'string') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
var stripped = firstLine.replace(/^chore(\([^)]+\))?:/, '').trim();
|
|
17
|
+
return semver.valid(stripped) !== null;
|
|
18
|
+
};
|
|
19
|
+
var test = function (r) { return r.test.bind(r); };
|
|
20
|
+
exports.wildcards = [
|
|
21
|
+
test(/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m),
|
|
22
|
+
test(/^(R|r)evert (.*)/),
|
|
23
|
+
test(/^(fixup|squash)!/),
|
|
24
|
+
isSemver,
|
|
25
|
+
test(/^Merged (.*?)(in|into) (.*)/),
|
|
26
|
+
test(/^Merge remote-tracking branch (.*)/),
|
|
27
|
+
test(/^Automatic merge(.*)/),
|
|
28
|
+
test(/^Auto-merged (.*?) into (.*)/)
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":";;;;;;;;;AAAA,6CAAiC;AAIjC,IAAM,QAAQ,GAAG,UAAC,CAAS;IAC1B,IAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;IAExC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QAClC,OAAO,KAAK,CAAC;KACb;IAED,IAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrE,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;AACxC,CAAC,CAAC;AAEF,IAAM,IAAI,GAAG,UAAC,CAAS,IAA+B,OAAA,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAd,CAAc,CAAC;AAExD,QAAA,SAAS,GAAc;IACnC,IAAI,CACH,mFAAmF,CACnF;IACD,IAAI,CAAC,kBAAkB,CAAC;IACxB,IAAI,CAAC,kBAAkB,CAAC;IACxB,QAAQ;IACR,IAAI,CAAC,6BAA6B,CAAC;IACnC,IAAI,CAAC,oCAAoC,CAAC;IAC1C,IAAI,CAAC,sBAAsB,CAAC;IAC5B,IAAI,CAAC,8BAA8B,CAAC;CACpC,CAAC"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.WILDCARDS = undefined;
|
|
7
|
-
exports.default = isIgnored;
|
|
8
|
-
|
|
9
|
-
var _semver = require('semver');
|
|
10
|
-
|
|
11
|
-
var _semver2 = _interopRequireDefault(_semver);
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
const WILDCARDS = exports.WILDCARDS = [c => c.match(/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m), c => c.match(/^(R|r)evert (.*)/), c => c.match(/^(fixup|squash)!/), c => _semver2.default.valid(c.split('\n').shift().replace(/^chore(\([^)]+\))?:/, '').trim()), c => c.match(/^Merged (.*?)(in|into) (.*)/), c => c.match(/^Merge remote-tracking branch (.*)/), c => c.match(/^Automatic merge(.*)/), c => c.match(/^Auto-merged (.*?) into (.*)/)];
|
|
16
|
-
|
|
17
|
-
function isIgnored(commit = '', opts = {}) {
|
|
18
|
-
const ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores;
|
|
19
|
-
|
|
20
|
-
if (!Array.isArray(ignores)) {
|
|
21
|
-
throw new Error(`ignores must be of type array, received ${ignores} of type ${typeof ignores}`);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const invalids = ignores.filter(c => typeof c !== 'function');
|
|
25
|
-
|
|
26
|
-
if (invalids.length > 0) {
|
|
27
|
-
throw new Error(`ignores must be array of type function, received items of type: ${invalids.map(i => typeof i).join(', ')}`);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const base = opts.defaults === false ? [] : WILDCARDS;
|
|
31
|
-
return [...base, ...ignores].some(w => w(commit));
|
|
1
|
+
"use strict";
|
|
2
|
+
function __export(m) {
|
|
3
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
32
4
|
}
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
__export(require("./is-ignored"));
|
|
33
7
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,kCAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-ignored.d.ts","sourceRoot":"","sources":["../src/is-ignored.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAChC,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAChC,MAAM,GAAE,MAAW,EACnB,IAAI,GAAE,gBAAqB,GACzB,OAAO,CAqBT"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
9
|
+
exports.__esModule = true;
|
|
10
|
+
var Defaults = __importStar(require("./defaults"));
|
|
11
|
+
function isIgnored(commit, opts) {
|
|
12
|
+
if (commit === void 0) { commit = ''; }
|
|
13
|
+
if (opts === void 0) { opts = {}; }
|
|
14
|
+
var ignores = typeof opts.ignores === 'undefined' ? [] : opts.ignores;
|
|
15
|
+
if (!Array.isArray(ignores)) {
|
|
16
|
+
throw new Error("ignores must be of type array, received " + ignores + " of type " + typeof ignores);
|
|
17
|
+
}
|
|
18
|
+
var invalids = ignores.filter(function (c) { return typeof c !== 'function'; });
|
|
19
|
+
if (invalids.length > 0) {
|
|
20
|
+
throw new Error("ignores must be array of type function, received items of type: " + invalids
|
|
21
|
+
.map(function (i) { return typeof i; })
|
|
22
|
+
.join(', '));
|
|
23
|
+
}
|
|
24
|
+
var base = opts.defaults === false ? [] : Defaults.wildcards;
|
|
25
|
+
return base.concat(ignores).some(function (w) { return w(commit); });
|
|
26
|
+
}
|
|
27
|
+
exports["default"] = isIgnored;
|
|
28
|
+
//# sourceMappingURL=is-ignored.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-ignored.js","sourceRoot":"","sources":["../src/is-ignored.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuC;AAOvC,SAAwB,SAAS,CAChC,MAAmB,EACnB,IAA2B;IAD3B,uBAAA,EAAA,WAAmB;IACnB,qBAAA,EAAA,SAA2B;IAE3B,IAAM,OAAO,GAAG,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IAExE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CACd,6CAA2C,OAAO,iBAAY,OAAO,OAAS,CAC9E,CAAC;KACF;IAED,IAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,OAAO,CAAC,KAAK,UAAU,EAAvB,CAAuB,CAAC,CAAC;IAE9D,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CACd,qEAAmE,QAAQ;aACzE,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,OAAO,CAAC,EAAR,CAAQ,CAAC;aAClB,IAAI,CAAC,IAAI,CAAG,CACd,CAAC;KACF;IAED,IAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;IAC/D,OAAW,IAAI,QAAK,OAAO,EAAE,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,MAAM,CAAC,EAAT,CAAS,CAAC,CAAC;AACnD,CAAC;AAxBD,+BAwBC"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/is-ignored",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Lint your commit messages",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
6
7
|
"files": [
|
|
7
8
|
"lib/"
|
|
8
9
|
],
|
|
9
10
|
"scripts": {
|
|
10
|
-
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
|
|
11
11
|
"deps": "dep-check",
|
|
12
|
-
"pkg": "pkg-check"
|
|
13
|
-
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
|
|
14
|
-
"test": "ava -c 4 --verbose",
|
|
15
|
-
"watch": "babel src --out-dir lib --watch --source-maps"
|
|
16
|
-
},
|
|
17
|
-
"ava": {
|
|
18
|
-
"files": [
|
|
19
|
-
"src/**/*.test.js",
|
|
20
|
-
"!lib/**/*"
|
|
21
|
-
],
|
|
22
|
-
"source": [
|
|
23
|
-
"src/**/*.js",
|
|
24
|
-
"!lib/**/*"
|
|
25
|
-
],
|
|
26
|
-
"babel": "inherit",
|
|
27
|
-
"require": [
|
|
28
|
-
"babel-register"
|
|
29
|
-
]
|
|
30
|
-
},
|
|
31
|
-
"babel": {
|
|
32
|
-
"presets": [
|
|
33
|
-
"babel-preset-commitlint"
|
|
34
|
-
]
|
|
12
|
+
"pkg": "pkg-check"
|
|
35
13
|
},
|
|
36
14
|
"engines": {
|
|
37
15
|
"node": ">=4"
|
|
@@ -56,18 +34,13 @@
|
|
|
56
34
|
},
|
|
57
35
|
"license": "MIT",
|
|
58
36
|
"devDependencies": {
|
|
59
|
-
"@commitlint/parse": "^8.
|
|
60
|
-
"@commitlint/test": "
|
|
61
|
-
"@commitlint/utils": "^8.
|
|
62
|
-
"ava": "0.22.0",
|
|
63
|
-
"babel-cli": "6.26.0",
|
|
64
|
-
"babel-preset-commitlint": "^8.0.0",
|
|
65
|
-
"babel-register": "6.26.0",
|
|
66
|
-
"concurrently": "3.5.1",
|
|
67
|
-
"cross-env": "5.1.1"
|
|
37
|
+
"@commitlint/parse": "^8.1.0",
|
|
38
|
+
"@commitlint/test": "8.0.0",
|
|
39
|
+
"@commitlint/utils": "^8.1.0"
|
|
68
40
|
},
|
|
69
41
|
"dependencies": {
|
|
70
|
-
"semver": "6.0.
|
|
42
|
+
"@types/semver": "^6.0.1",
|
|
43
|
+
"semver": "6.1.1"
|
|
71
44
|
},
|
|
72
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "c17420d67adafdf37f68d6861d29a0e85a4a3bd7"
|
|
73
46
|
}
|
package/lib/index.test.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _ava = require('ava');
|
|
4
|
-
|
|
5
|
-
var _ava2 = _interopRequireDefault(_ava);
|
|
6
|
-
|
|
7
|
-
var _ = require('.');
|
|
8
|
-
|
|
9
|
-
var _2 = _interopRequireDefault(_);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
const VERSION_MESSAGES = ['0.0.1', '0.1.0', '1.0.0', '0.0.1-alpha', '0.0.1-some-crazy-tag', '0.0.1-0', '0.0.1-999', '0.0.1-alpha.0', '0.0.1-alpha.999', '0.0.1-some-crazy-tag.0', '0.0.1-some-crazy-tag.999', '0.0.1-1e69d54', 'v0.0.1', ' v3.0.0'];
|
|
14
|
-
|
|
15
|
-
const AMENDMENTS = ['Signed-off-by: Developer <example@example.com>', 'Change-Id: I895114872a515a269487a683124b63303818e19c', 'Signed-off-by: Developer <example@example.com>\nChange-Id: I895114872a515a269487a683124b63303818e19c'];
|
|
16
|
-
|
|
17
|
-
const AMENDED_VERSION_MESSAGES = VERSION_MESSAGES.reduce((results, message) => {
|
|
18
|
-
return [...results, ...AMENDMENTS.map(amendment => `${message}\n\n${amendment}`)];
|
|
19
|
-
}, []);
|
|
20
|
-
|
|
21
|
-
(0, _ava2.default)('should return false when called without arguments', t => {
|
|
22
|
-
t.false((0, _2.default)());
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
(0, _ava2.default)('should return false when called with empty string', t => {
|
|
26
|
-
t.false((0, _2.default)(''));
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
(0, _ava2.default)('should return false for normal commit', t => {
|
|
30
|
-
t.false((0, _2.default)('initial commit'));
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
(0, _ava2.default)('should return true for branch merges', t => {
|
|
34
|
-
t.true((0, _2.default)("Merge branch 'iss53'"));
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
(0, _ava2.default)('should return true for branch merges with newline characters', t => {
|
|
38
|
-
t.true((0, _2.default)("Merge branch 'ctrom-YarnBuild'\n"));
|
|
39
|
-
t.true((0, _2.default)("Merge branch 'ctrom-YarnBuild'\r\n"));
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
(0, _ava2.default)('should return true for branch merges with multiple newline characters', t => {
|
|
43
|
-
t.true((0, _2.default)("Merge branch 'ctrom-YarnBuild'\n\n\n"));
|
|
44
|
-
t.true((0, _2.default)("Merge branch 'ctrom-YarnBuild'\r\n\r\n\r\n"));
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
(0, _ava2.default)('should return true for merged PRs', t => {
|
|
48
|
-
t.true((0, _2.default)('Merge pull request #369'));
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
(0, _ava2.default)('should return true for branch merges with newline characters and more characters after it', t => {
|
|
52
|
-
t.true((0, _2.default)("Merge branch 'ctrom-YarnBuild'\n "));
|
|
53
|
-
t.true((0, _2.default)("Merge branch 'ctrom-YarnBuild'\r\n # some comment"));
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
(0, _ava2.default)('should return true for revert commits', t => {
|
|
57
|
-
t.true((0, _2.default)(`Revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`));
|
|
58
|
-
t.true((0, _2.default)(`revert "docs: add recipe for linting of all commits in a PR (#36)"\n\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`));
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
(0, _ava2.default)('should ignore npm semver commits', t => {
|
|
62
|
-
VERSION_MESSAGES.forEach(message => t.true((0, _2.default)(message)));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
(0, _ava2.default)('should ignore npm semver commits with chore', t => {
|
|
66
|
-
VERSION_MESSAGES.forEach(message => t.true((0, _2.default)(`chore: ${message}`)));
|
|
67
|
-
VERSION_MESSAGES.forEach(message => t.true((0, _2.default)(`chore(release): ${message}`)));
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
(0, _ava2.default)('should ignore npm semver commits with footers', t => {
|
|
71
|
-
AMENDED_VERSION_MESSAGES.forEach(message => t.true((0, _2.default)(message)));
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
(0, _ava2.default)('should return true fixup commits', t => {
|
|
75
|
-
t.true((0, _2.default)('fixup! initial commit'));
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
(0, _ava2.default)('should return true squash commits', t => {
|
|
79
|
-
t.true((0, _2.default)('squash! initial commit'));
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
(0, _ava2.default)('should return true for bitbucket merge commits', t => {
|
|
83
|
-
t.true((0, _2.default)('Merged in feature/facebook-friends-sync (pull request #8)'));
|
|
84
|
-
t.true((0, _2.default)('Merged develop into feature/component-form-select-card'));
|
|
85
|
-
t.true((0, _2.default)('Automatic merge'));
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
(0, _ava2.default)('should return true for automatic merge commits', t => {
|
|
89
|
-
t.true((0, _2.default)('Auto-merged develop into master'));
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
(0, _ava2.default)('should return false for commits containing, but not starting, with merge branch', t => {
|
|
93
|
-
t.false((0, _2.default)('foo bar Merge branch xxx'));
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
(0, _ava2.default)('should return false for ignored message if defaults is false', t => {
|
|
97
|
-
t.false((0, _2.default)('Auto-merged develop into master', {
|
|
98
|
-
defaults: false
|
|
99
|
-
}));
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
(0, _ava2.default)('should return false for ignored message if custom ignores and defaults is false', t => {
|
|
103
|
-
t.false((0, _2.default)('Auto-merged develop into master', {
|
|
104
|
-
defaults: false
|
|
105
|
-
}));
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
(0, _ava2.default)('should throw error if ignores is not an array', t => {
|
|
109
|
-
const ignoredString = 'this should be ignored';
|
|
110
|
-
t.throws(() => {
|
|
111
|
-
(0, _2.default)(ignoredString, {
|
|
112
|
-
ignores: 'throws error'
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
(0, _ava2.default)('should return true for custom ignores as function', t => {
|
|
118
|
-
const ignoredString = 'this should be ignored';
|
|
119
|
-
t.true((0, _2.default)(ignoredString, {
|
|
120
|
-
ignores: [c => c === ignoredString]
|
|
121
|
-
}));
|
|
122
|
-
});
|
|
123
|
-
//# sourceMappingURL=index.test.js.map
|
package/lib/index.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.test.js"],"names":["VERSION_MESSAGES","AMENDMENTS","AMENDED_VERSION_MESSAGES","reduce","results","message","map","amendment","t","false","true","forEach","defaults","ignoredString","throws","ignores","c"],"mappings":";;AAAA;;;;AACA;;;;;;AAEA,MAAMA,mBAAmB,CACxB,OADwB,EAExB,OAFwB,EAGxB,OAHwB,EAIxB,aAJwB,EAKxB,sBALwB,EAMxB,SANwB,EAOxB,WAPwB,EAQxB,eARwB,EASxB,iBATwB,EAUxB,wBAVwB,EAWxB,0BAXwB,EAYxB,eAZwB,EAaxB,QAbwB,EAcxB,SAdwB,CAAzB;;AAiBA,MAAMC,aAAa,CAClB,gDADkB,EAElB,sDAFkB,EAGlB,sGAHkB,CAAnB;;AAMA,MAAMC,2BAA2BF,iBAAiBG,MAAjB,CAAwB,CAACC,OAAD,EAAUC,OAAV,KAAsB;AAC9E,QAAO,CACN,GAAGD,OADG,EAEN,GAAGH,WAAW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AL,EAAsDJ,KAAK;AAC1D,OAAMK,gBAAgB,wBAAtB;AACAL,GAAEM,MAAF,CAAS,MAAM;AACd,kBAAUD,aAAV,EAAyB;AACxBE,YAAS;AADe,GAAzB;AAGA,EAJD;AAKA,CAPD;;AASA,mBAAK,mDAAL,EAA0DP,KAAK;AAC9D,OAAMK,gBAAgB,wBAAtB;AACAL,GAAEE,IAAF,CACC,gBAAUG,aAAV,EAAyB;AACxBE,WAAS,CAACC,KAAKA,MAAMH,aAAZ;AADe,EAAzB,CADD;AAKA,CAPD","file":"index.test.js","sourcesContent":["import test from 'ava';\nimport isIgnored from '.';\n\nconst VERSION_MESSAGES = [\n\t'0.0.1',\n\t'0.1.0',\n\t'1.0.0',\n\t'0.0.1-alpha',\n\t'0.0.1-some-crazy-tag',\n\t'0.0.1-0',\n\t'0.0.1-999',\n\t'0.0.1-alpha.0',\n\t'0.0.1-alpha.999',\n\t'0.0.1-some-crazy-tag.0',\n\t'0.0.1-some-crazy-tag.999',\n\t'0.0.1-1e69d54',\n\t'v0.0.1',\n\t' v3.0.0'\n];\n\nconst AMENDMENTS = [\n\t'Signed-off-by: Developer <example@example.com>',\n\t'Change-Id: I895114872a515a269487a683124b63303818e19c',\n\t'Signed-off-by: Developer <example@example.com>\\nChange-Id: I895114872a515a269487a683124b63303818e19c'\n];\n\nconst AMENDED_VERSION_MESSAGES = VERSION_MESSAGES.reduce((results, message) => {\n\treturn [\n\t\t...results,\n\t\t...AMENDMENTS.map(amendment => `${message}\\n\\n${amendment}`)\n\t];\n}, []);\n\ntest('should return false when called without arguments', t => {\n\tt.false(isIgnored());\n});\n\ntest('should return false when called with empty string', t => {\n\tt.false(isIgnored(''));\n});\n\ntest('should return false for normal commit', t => {\n\tt.false(isIgnored('initial commit'));\n});\n\ntest('should return true for branch merges', t => {\n\tt.true(isIgnored(\"Merge branch 'iss53'\"));\n});\n\ntest('should return true for branch merges with newline characters', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n\"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n\"));\n});\n\ntest('should return true for branch merges with multiple newline characters', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n\\n\\n\"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n\\r\\n\\r\\n\"));\n});\n\ntest('should return true for merged PRs', t => {\n\tt.true(isIgnored('Merge pull request #369'));\n});\n\ntest('should return true for branch merges with newline characters and more characters after it', t => {\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\n \"));\n\tt.true(isIgnored(\"Merge branch 'ctrom-YarnBuild'\\r\\n # some comment\"));\n});\n\ntest('should return true for revert commits', t => {\n\tt.true(\n\t\tisIgnored(\n\t\t\t`Revert \"docs: add recipe for linting of all commits in a PR (#36)\"\\n\\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`\n\t\t)\n\t);\n\tt.true(\n\t\tisIgnored(\n\t\t\t`revert \"docs: add recipe for linting of all commits in a PR (#36)\"\\n\\nThis reverts commit 1e69d542c16c2a32acfd139e32efa07a45f19111.`\n\t\t)\n\t);\n});\n\ntest('should ignore npm semver commits', t => {\n\tVERSION_MESSAGES.forEach(message => t.true(isIgnored(message)));\n});\n\ntest('should ignore npm semver commits with chore', t => {\n\tVERSION_MESSAGES.forEach(message => t.true(isIgnored(`chore: ${message}`)));\n\tVERSION_MESSAGES.forEach(message =>\n\t\tt.true(isIgnored(`chore(release): ${message}`))\n\t);\n});\n\ntest('should ignore npm semver commits with footers', t => {\n\tAMENDED_VERSION_MESSAGES.forEach(message => t.true(isIgnored(message)));\n});\n\ntest('should return true fixup commits', t => {\n\tt.true(isIgnored('fixup! initial commit'));\n});\n\ntest('should return true squash commits', t => {\n\tt.true(isIgnored('squash! initial commit'));\n});\n\ntest('should return true for bitbucket merge commits', t => {\n\tt.true(\n\t\tisIgnored('Merged in feature/facebook-friends-sync (pull request #8)')\n\t);\n\tt.true(isIgnored('Merged develop into feature/component-form-select-card'));\n\tt.true(isIgnored('Automatic merge'));\n});\n\ntest('should return true for automatic merge commits', t => {\n\tt.true(isIgnored('Auto-merged develop into master'));\n});\n\ntest('should return false for commits containing, but not starting, with merge branch', t => {\n\tt.false(isIgnored('foo bar Merge branch xxx'));\n});\n\ntest('should return false for ignored message if defaults is false', t => {\n\tt.false(\n\t\tisIgnored('Auto-merged develop into master', {\n\t\t\tdefaults: false\n\t\t})\n\t);\n});\n\ntest('should return false for ignored message if custom ignores and defaults is false', t => {\n\tt.false(\n\t\tisIgnored('Auto-merged develop into master', {\n\t\t\tdefaults: false\n\t\t})\n\t);\n});\n\ntest('should throw error if ignores is not an array', t => {\n\tconst ignoredString = 'this should be ignored';\n\tt.throws(() => {\n\t\tisIgnored(ignoredString, {\n\t\t\tignores: 'throws error'\n\t\t});\n\t});\n});\n\ntest('should return true for custom ignores as function', t => {\n\tconst ignoredString = 'this should be ignored';\n\tt.true(\n\t\tisIgnored(ignoredString, {\n\t\t\tignores: [c => c === ignoredString]\n\t\t})\n\t);\n});\n"]}
|