danger-plugin-no-test-shortcuts
Danger plugin to prevent merging test shortcuts (.only and .skip)
Usage
Import and invoke the noTestShortcuts()
function in your Dangerfile:
import noTestShortcuts from 'danger-plugin-no-test-shortcuts'
noTestShortcuts({
testFilePredicate: (filePath) => filePath.endsWith('.test.js'),
})
By default, Danger will fail the build if a new or modified test file contains .only()
- this prevents merging changes that will prevent your entire test suite from running on each pull request.
This plugin takes an optional config object with a couple of options:
noTestShortcuts({
testFilePredicate: (filePath) => filePath.endsWith('.test.js'),
skippedTests: 'fail',
patterns: {
only: ['customOnly'],
skip: ['sk.ip']
}
})
Development
Install Yarn and install the dependencies - yarn install
.
Run the tests with yarn test
(uses Jest).
This project uses semantic-release for automated NPM package publishing.
The main caveat: instead of running git commit
, run yarn commit
and follow the prompts to input a conventional changelog message via commitizen.