0.21.0 • Published 2 years ago

module-testrunner v0.21.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Module Testrunner

Runs test files that export a top level function to enable initialisation.

Table of Contents

Install

https://www.npmjs.com/package/module-testrunner
npm install module-testrunner

Usage

CLI

npx test test_files

API

const { run } = require('module-testrunner');
const options = { ... };
run(options);

Options

  • files: Array of test file paths.
  • args: Array of custom test arguments. Default: Result of loading main from package.json or ./index.js.
  • test: Function that runs a test. Default: Result of loading node:test.
  • assert: Assertion library. Default: Result of loading node:assert.
  • context: Additional context object to make accessible to each test.

Example

Basic

module.exports = ({ test, assert }) => {

    test('it passes', () => {
        assert(true);
    });

};

Advanced

module.exports = ({ test, assert, context }) => args => {

    test('initialises the app', () => {
        const app = args.initialise();
        assert(context.helpers.appInitialised(app));
    });

};
0.21.0

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.18.0

2 years ago

0.17.0

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.14.0

2 years ago

0.13.0

2 years ago

0.12.0

2 years ago

0.11.0

2 years ago

0.10.0

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago