diff --git a/.travis.yml b/.travis.yml index 67a242e59..8498e479d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ script: - yarn commitlint --from="$TRAVIS_BRANCH" --to="$TRAVIS_COMMIT" - yarn commitlint --from=$TRAVIS_COMMIT - yarn prettylint -- yarn test +- yarn test --coverage after_script: greenkeeper-lockfile-upload jobs: include: diff --git a/package.json b/package.json index ec05c4c9f..0a338d770 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,14 @@ "*.{md,json}": ["prettier --write", "git add"] }, "jest": { + "coverageThreshold": { + "global": { + "branches": 96, + "functions": 97, + "lines": 99, + "statements": 99 + } + }, "projects": [ { "displayName": "test", diff --git a/rules/__tests__/no-disabled-tests.test.js b/rules/__tests__/no-disabled-tests.test.js index 88d4636f8..0720d3403 100644 --- a/rules/__tests__/no-disabled-tests.test.js +++ b/rules/__tests__/no-disabled-tests.test.js @@ -15,6 +15,8 @@ ruleTester.run('no-disabled-tests', rule, { 'test.only("foo", function () {})', 'var appliedSkip = describe.skip; appliedSkip.apply(describe)', 'var calledSkip = it.skip; calledSkip.call(it)', + '({ f: function () {} }).f()', + '(a || b).f()', ], invalid: [ @@ -80,6 +82,10 @@ ruleTester.run('no-disabled-tests', rule, { { message: 'Call to pending() within test', column: 48, line: 1 }, ], }, + { + code: 'pending();', + errors: [{ message: 'Call to pending()', column: 1, line: 1 }], + }, { code: 'describe("contains a call to pending", function () { pending() })', errors: [ diff --git a/rules/no-disabled-tests.js b/rules/no-disabled-tests.js index 5fe939c0c..ca796f985 100644 --- a/rules/no-disabled-tests.js +++ b/rules/no-disabled-tests.js @@ -69,6 +69,11 @@ module.exports = { message: 'Call to pending() within test suite', node, }); + } else { + context.report({ + message: 'Call to pending()', + node, + }); } break; diff --git a/rules/util.js b/rules/util.js index 67ee94f60..c63990250 100644 --- a/rules/util.js +++ b/rules/util.js @@ -129,7 +129,7 @@ const isFunction = node => * package version to build the link to a tagged version of the * documentation file. * - * @param {string} ruleName - Name of the eslint rule + * @param {string} filename - Name of the eslint rule * @returns {string} URL to the documentation for the given rule * @throws {Error} If the documentation file for the given rule is not present. */ @@ -137,6 +137,7 @@ const getDocsUrl = filename => { const ruleName = path.basename(filename, '.js'); const docsFile = path.join(__dirname, `../docs/rules/${ruleName}.md`); + // istanbul ignore if if (!fs.existsSync(docsFile)) { throw new Error(`Could not find documentation file for rule "${ruleName}"`); }