JSPM

  • Created
  • Published
  • Downloads 670
  • Score
    100M100P100Q92750F
  • License MIT

Drop in replacement for mocha to abstract commonly used test setups

Package Exports

  • node-tdd

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-tdd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-tdd

Build Status Test Coverage Dependabot Status Dependencies NPM Downloads Semantic-Release Gardener

Drop in replacement for mocha to abstract commonly used test setups

Install

Install with npm:

$ npm install --save node-tdd

Usage

Drop-in replacement for mocha by simply importing describe as below.

const expect = require('chai').expect;
const { describe } = require('node-tdd');

describe('Testing some stuff', /* { ...options }, */ () => {
  it('Testing a thing', () => {
    expect(3 * 7).to.equal(21);
  });
});

Please see tests for further usage examples.

Options

useTmpDir

Type: boolean
Default: false

When set to true, a fresh temporary directory is set up for each test. The directory is cleaned up after the test run has completed.

useNock

Type: boolean
Default: false

When set to true, all requests are automatically nocked. The recording files are automatically created relative to the current test file.

envVars

Type: object
Default: -

Used to declare environment variables per describe. Environment variables are also picked up from shadow files as e.g. test.spec.js.env.yml.

To allow overwriting of environment variables prefix the name of the environment variable with ^.

timestamp

Type: number
Default: -

Set unix timestamp to freeze time to. Will modify the result of e.g. new Date().

recordConsole

Type: boolean
Default: false

When set to true, console logging calls are recorded and can be accessed by calling getConsoleOutput() from within the test.

cryptoSeed

Type: string
Default: -

When set, randomization is overwritten and consistent per test using the provided seed.