jenkins-mocha

    8.0.0 • Public • Published

    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

    Install

    npm i jenkins-mocha

    DownloadsWeekly Downloads

    1,868

    Version

    8.0.0

    License

    MIT

    Unpacked Size

    21.6 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar
    • avatar