Socket
Socket
Sign inDemoInstall

testit

Package Overview
Dependencies
13
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    testit

Because the world needs a simpler testing framework


Version published
Weekly downloads
177
increased by82.47%
Maintainers
2
Install size
291 kB
Created
Weekly downloads
 

Readme

Source

testit

Because the world needs a simpler testing framework. Check out the travis build log for an example of test output and check out the test folder for an example test suite.

This module also works seamlessly with istanbul for code coverage (see package.json) and sauce-test for browser testing via browserify.

Build Status Coverage Status Dependency Status NPM version

Sauce Test Status

Installation

npm install testit

Sample test script

var assert = require('assert')
var test = require('testit')

test('synchronous tests', function () {
  test('passes tests that do not fail', function () {
    assert(true)
  })
  test('fails tests that fail', function () {
    assert(false)
  })
})

test('asynchronous tests with callbacks', function () {
  test('passes some async tests', function (done) {
    setTimeout(done, 100)
  })
  test('fails some async tests', function (done) {
    setTimeout(function () {
      done(new Error('oh dear'))
    }, 100)
  })
  test('times out some tests', function (done) {
    setTimeout(function () {
      done()
    }, 99999999999)
  })
  test('supports custom timeouts', function (done) {
    setTimeout(done, 1000)
  }, {timeout: '1 second'})
})
test('supports promises just as well as callbacks', function () {
  return new Promise(function (resolve) {
    setTimeout(resolve, 100)
  })
})

License

MIT

FAQs

Last updated on 16 Jan 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc