11.0.0 • Published 2 years ago

jenkins-mocha v11.0.0

Weekly downloads
2,488
License
MIT
Repository
github
Last release
2 years ago

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

10.0.0

2 years ago

11.0.0

2 years ago

9.0.0

3 years ago

8.0.0

5 years ago

7.0.0

6 years ago

6.0.0

7 years ago

5.0.0

7 years ago

4.1.2

8 years ago

4.1.1

8 years ago

4.1.0

8 years ago

4.0.0

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.6.0

9 years ago

2.5.0

9 years ago

2.4.0

9 years ago

2.3.1

9 years ago

2.3.0

9 years ago

2.2.0

10 years ago

2.1.0

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago