GithubHelp home page GithubHelp logo

deecewan / danger-plugin-no-test-shortcuts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from macklinu/danger-plugin-no-test-shortcuts

0.0 3.0 0.0 88 KB

Danger plugin to prevent merging test shortcuts (.only and .skip)

Home Page: https://www.npmjs.com/package/danger-plugin-no-test-shortcuts

License: MIT License

JavaScript 94.40% TypeScript 5.60%

danger-plugin-no-test-shortcuts's Introduction

danger-plugin-no-test-shortcuts

Build Status npm version

Danger plugin to prevent merging test shortcuts (.only and .skip)

Usage

Import and invoke the noTestShortcuts() function in your Dangerfile:

// dangerfile.js or dangerfile.ts
import noTestShortcuts from 'danger-plugin-no-test-shortcuts'

noTestShortcuts()

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({
  // A predicate for determining where your test files live.
  // Defaults to file paths that start with 'tests' (e.g. tests/index.spec.js).
  testFilePredicate: (filePath) => filePath.endsWith('.test.js'),

  // Defines the behavior for handling skipped tests (e.g. test.skip()).
  // Defaults to 'ignore'.
  // Valid values: 'ignore', 'fail', 'warn'.
  skippedTests: 'fail',

  // Defines any (additional) patterns you want to test for
  // Defaults to no extra patterns
  // Here you can add patterns specific to how your test framework does skips/onlys
  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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.