Skip to content

Commit 58f4396

Browse files
authoredFeb 17, 2018
fix(coverage): get close to 100% test coverage (#67)
1 parent 6f2256b commit 58f4396

File tree

5 files changed

+22
-2
lines changed

5 files changed

+22
-2
lines changed
 

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ script:
1414
- yarn commitlint --from="$TRAVIS_BRANCH" --to="$TRAVIS_COMMIT"
1515
- yarn commitlint --from=$TRAVIS_COMMIT
1616
- yarn prettylint
17-
- yarn test
17+
- yarn test --coverage
1818
after_script: greenkeeper-lockfile-upload
1919
jobs:
2020
include:

‎package.json

+8
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@
5151
"*.{md,json}": ["prettier --write", "git add"]
5252
},
5353
"jest": {
54+
"coverageThreshold": {
55+
"global": {
56+
"branches": 96,
57+
"functions": 97,
58+
"lines": 99,
59+
"statements": 99
60+
}
61+
},
5462
"projects": [
5563
{
5664
"displayName": "test",

‎rules/__tests__/no-disabled-tests.test.js

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ ruleTester.run('no-disabled-tests', rule, {
1515
'test.only("foo", function () {})',
1616
'var appliedSkip = describe.skip; appliedSkip.apply(describe)',
1717
'var calledSkip = it.skip; calledSkip.call(it)',
18+
'({ f: function () {} }).f()',
19+
'(a || b).f()',
1820
],
1921

2022
invalid: [
@@ -80,6 +82,10 @@ ruleTester.run('no-disabled-tests', rule, {
8082
{ message: 'Call to pending() within test', column: 48, line: 1 },
8183
],
8284
},
85+
{
86+
code: 'pending();',
87+
errors: [{ message: 'Call to pending()', column: 1, line: 1 }],
88+
},
8389
{
8490
code: 'describe("contains a call to pending", function () { pending() })',
8591
errors: [

‎rules/no-disabled-tests.js

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ module.exports = {
6969
message: 'Call to pending() within test suite',
7070
node,
7171
});
72+
} else {
73+
context.report({
74+
message: 'Call to pending()',
75+
node,
76+
});
7277
}
7378
break;
7479

‎rules/util.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ const isFunction = node =>
129129
* package version to build the link to a tagged version of the
130130
* documentation file.
131131
*
132-
* @param {string} ruleName - Name of the eslint rule
132+
* @param {string} filename - Name of the eslint rule
133133
* @returns {string} URL to the documentation for the given rule
134134
* @throws {Error} If the documentation file for the given rule is not present.
135135
*/
136136
const getDocsUrl = filename => {
137137
const ruleName = path.basename(filename, '.js');
138138

139139
const docsFile = path.join(__dirname, `../docs/rules/${ruleName}.md`);
140+
// istanbul ignore if
140141
if (!fs.existsSync(docsFile)) {
141142
throw new Error(`Could not find documentation file for rule "${ruleName}"`);
142143
}

0 commit comments

Comments
 (0)
Please sign in to comment.