šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Sign inDemoInstall
Socket

jenkins-mocha

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jenkins-mocha

Bin wrapper for Mocha + Nyc + Xunit (for Jenkins)

11.0.0
latest
Source
npm
Version published
Maintainers
2
Created
Source

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

Keywords

mocha

FAQs

Package last updated on 04 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts