1.0.1 • Published 11 months ago

@rhobweb/unit-test-utils v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@rhobweb/unit-test-utils

Overview

Simple framework for unit testing CJS Node.js modules using the following modules:

  • mocha - testing framework;
  • chai - assertion library;
  • sinon - test framework for stubs, spies and mocks;
  • nyc - code coverage checker;
  • rewire - allows access to the unexported items from the module under test;

Features

The following unexported module items may be stubbed for testing:

  • function;
  • class constructor.

Unexported module items, e.g., variables, required modules, may be accessed and faked.

Usage

See ./test/unit for example usage.

Testing

The following test scripts may be run from the command line:

  • npm run test
    • Runs the unit tests, code coverage and outputs the coverage stats.
  • npm run coverage
    • Generates the code coverage data in html format in the './coverage' directory.
  • npm run lint
    • Run eslint on the source and test code; if no errors are detected, only the lint command line is output.
1.0.1

11 months ago

1.0.0

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago