Acro / node-bandage-runner

A bandage runner API allowing you to create custom test runners.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bandage-runner-ts

A bandage runner API allowing you to create custom test runners.

Build Status js-standard-style npm

npm install bandage-runner --save-dev

Usage

test.js
var runner = require('bandage-runner')
var testHelper = require('./your-test-helper')
var dependencyContainer = require('./your-dependency-container')

var testParams = [testHelper, dependencyContainer]

runner(testParams)
test/example.test.js

Works with default export:

module.exports = function(should, helper, container) {
  should('be awesome', function* (t) {
    t.ok(true, 'checked')
  }
}
test/example2.test.js

Works with exported functions that start or end with "test" (case insensitive):

exports.test_one = function(should, helper, container) {
  should('be awesome once', function* (t) {
    t.ok(true, 'checked')
  }
}

exports.second_test = function(should, helper, container) {
  should('be awesome twice', function* (t) {
    t.ok(true, 'checked')
  }
}

exports.thirdTest = function(should, helper, container) {
  should('be awesome three times', function* (t) {
    t.ok(true, 'checked')
  }
}
package.json
{
  "scripts": {
    "test": "node test.js"
  }
}

Features

  • Auto-locates tests in the test directory.
  • Supports naming test files *.test.js, *.tests.js, test.js, and tests.js.
  • Supports passing values into tests.
  • Supports passing in an alternative array of test files (ignores the default file glob).

API

runner(params, file, endCb)

arguments
  • [params]: (Array) parameters to pass to exported test function.
  • [files] (Array|String) exact path(s) of file(s) containing tests.
  • [endCb] (Function) function which is called after all tests finish.

About

A bandage runner API allowing you to create custom test runners.

License:MIT License


Languages

Language:JavaScript 100.0%