0.3.0 • Published 7 years ago

runas-recipe-unit-testing v0.3.0

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
7 years ago

runas Recipe runas-recipe-unit-testing

Unit testing with coverage for recipes and npm-libraries. Using mocha (default) and nyc for the matter.

  1. Description
  2. Configuration
  3. More information

Description

Step for recipe and npm-library contexts. It will run the tests configured in the repo and will calculate the coverage of such test suites. It will check the thresholds for this repo in particular.

We will be able to configure our recipe parameters as usual, in our piscosour.json file. But we also can configure it in the package.json or in a .nycrc file. All the documentation in this link

Configuration

Example:

{
  "test-runner-nyc": {
    "ignoreErrors": true,
    "config": {
      "_": [
        "npm",
        "test"
      ],
      "all": true,
      "reportDir": "test-reports",
      "reporter": [
        "text-summary",
        "lcov",
        "html"
      ],
      "exclude": [
        "node_modules",
        "*-test.js",
        "test-reports/**",
        "test/**"
      ],
      "checkCoverage": true,
      "statements": 70,
      "branches": 70,
      "functions": 70,
      "lines": 70
    }
  }
}

Where:

ParamTypeDefaultDescription
_Array"npm", "test"Execution for the unit tests in the recipe
allBooleantrueInclude all the files in the coverage report
reportDirString"test-reports"Directory where the reports are stored
reporterArray"text-summary", "lcov", "html"Reports generated
excludeArray"node_modules", "*-test.js", "test-reports/", "test/"Files excluded
checkCoverageBooleantrueCheck for the coverage thresholds
statementsInteger70Threshold for staments percent coverage
branchesInteger70Threshold for branches percent coverage
functionsInteger70Threshold for functions percent coverage
linesInteger70Threshold for lines percent coverage

More information:

  • Contexts: "recipe", "npm-library"
  • Plugins: "test-runner-istanbul"