Skip to content

depject/deptest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deptest

depject plugin for tests

Give tests from your depject modules.

Usage

const combine = require('depject')
const {first} = require('depject/apply')
const deptest = require('deptest')

const tests = {
  gives: 'tests',
  create: function (api) {
    return function (tests) {
      tests['addition'] = function (assert, cb) {
        assert(1 + 1 === 2)
        cb()
      }
      tests['async maths'] = function (assert, cb) {
        setTimeout(() => {
          assert(1 + 1 === 2)
          cb()
        }, 300)
      }
      return tests
    }
  }
}
 
//lines below would normally be in test.js or similar
//combine your tests with your other modules
const modules = combine([tests, deptest])

//Run the tests!
first(modules.test)()

outputs

✔ addition
✔ async maths

API

Needs

exports.needs = nest({
  'tests': 'reduce'
})

Gives

exports.gives = nest({
  'test'
})

Giving tests functions

You give tests functions from your modules that have the shape:

  (tests) => tests

Where tests is an object that has shape:

{
  'my test name': (assert, cb) =>{}   
}

Install

With npm installed, run

$ npm install deptest

See Also

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published