Home

Awesome

pull-test

run assertion tests using pull streams

npm install --save-dev pull-test

example

// example.js
module.exports = {
  'it succeeds': function (assert) {
    assert(true)
  },
  'it fails!': function (assert) {
    assert(false)
  },
  'it errors!': function (assert, cb) {
    cb(new Error('error'))
  }
}

pull-test example.js

✔ it succeeds
✖ it fails!
{ AssertionError: false == true
   at tests (pull-test/example.js:9:5)
 name: 'AssertionError',
 actual: false,
 expected: true,
 operator: '==',
 message: 'false == true',
 generatedMessage: true }
▲ test runner ended with an error
Error: error
   at tests (pull-test/example.js:12:8)

cli

if test/*.js represents a set of files exporting tests,

runs these tests using built-in assert and default reporter with:

pull-test test/*.js

api

test = require('pull-test')

test(tests)

runs tests using built-in assert and default reporter.

testSource = test.from(tests)

creates a source pull stream of test objects,

from any of the following format of tests:

function testTheThing (assert, cb) {
  assert(true), cb()
}
{
  ['test the thing']: function (assert, cb) {
    assert(true), cb()
  }
}
[{
  name: 'test the thing',
  test: function (assert, cb) {
    assert(true), cb()
  }
}]

through = test.Tester(options)

creates a through pull stream,

which expects to receive test objects with shape:

and will return test result objects with shape:

sink = test.Reporter(options)

creates a sink pull stream,

which receives test result objects and logs to the console.

license

The Apache License

Copyright © 2016 Michael Williams

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.