Giter Club home page Giter Club logo

jenkins-mocha's Introduction

jenkins-mocha

Single command to run your Mocha unit tests with both XUnit and LCov output (for Jenkins).

Version Downloads Build Status Open Issues Dependency Status Coverage Vulnerabilities License

Installation

jenkins-mocha should be added to your test codebase as a dev dependency. You can do this with:

$ npm install --save-dev jenkins-mocha

Alternatively you can manually add it to your package.json file:

{
  "devDependencies" : {
    "jenkins-mocha": "latest"
  }
}

then install with:

$ npm install --dev

Run

jenkins-mocha should replace your mocha command in npm test

{
    "scripts": {
        "test": "jenkins-mocha test/*"
    }
}

With coverage on (the default), you can pass a --cobertura option to the command to have nyc use the cobertura reporter

{
    "scripts": {
        "devtest": "jenkins-mocha --cobertura test/*"
    }
}

If you want to turn coverage reporting off entirely, and just run unit tests with mocha, you need to pass a --no-coverage option to the command

{
    "scripts": {
        "devtest": "jenkins-mocha --no-coverage test/*"
    }
}

Any other parameters added to the command will be passed directly to mocha.

If you need to configure nyc, you may create a .nycrc configuration file. Run nyc help config for details.

If you want to configure how node is invoked (if you have a giant coverage file), you can set v8 arguments via $(NODE_ARGS).

{
    "scripts": {
        "test": "NODE_ARGS='--max_old_space_size=4096' jenkins-mocha test/*"
    }
}

When npm-test is invoked, the module will:

  • Create XUnit test results in $(TEST_DIR)
  • Create LCov coverage in $(COVERAGE_DIR) with a HTML report at $(COVERAGE_DIR)\lcov-report

Default values are:

  • $(ARTIFACTS_DIR) = ./artifacts
  • $(TEST_DIR) = ./$(ARTIFACTS_DIR)/test
  • $(COVERAGE_DIR) = ./$(ARTIFACTS_DIR)/coverage

License

MIT © St. John Johnson

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.