All Projects → ivoputzer → m.test

ivoputzer / m.test

Licence: other
m(icro)test is a lightweight test runner for node.js written in es6+

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to m.test

Redux Form Test
Shows how to do unit tests and integration tests with Redux-Form
Stars: ✭ 221 (+1200%)
Mutual labels:  test
Vuex Mock Store
✅Simple and straightforward Vuex Store mock for vue-test-utils
Stars: ✭ 246 (+1347.06%)
Mutual labels:  test
Starwars-clean
Simple project with clean architecture
Stars: ✭ 34 (+100%)
Mutual labels:  test
Ocaramba
C# Framework to automate tests using Selenium WebDriver
Stars: ✭ 234 (+1276.47%)
Mutual labels:  test
Alsatian
TypeScript testing framework with test cases
Stars: ✭ 244 (+1335.29%)
Mutual labels:  test
Betterer
betterer makes it easier to make incremental improvements to your codebase
Stars: ✭ 248 (+1358.82%)
Mutual labels:  test
Pkg Ok
👌 Checks paths and scripts defined in package.json before you publish
Stars: ✭ 219 (+1188.24%)
Mutual labels:  test
s3-example
Simple example using micro for uploading stuff to AWS S3.
Stars: ✭ 45 (+164.71%)
Mutual labels:  micro
Fluentdocker
Commands, Services and Fluent API for docker, docker-compose & docker-machine, for win/mac/linux and native docker in c#
Stars: ✭ 245 (+1341.18%)
Mutual labels:  test
testza
Full-featured test framework for Go! Assertions, fuzzing, input testing, output capturing, and much more! 🍕
Stars: ✭ 409 (+2305.88%)
Mutual labels:  test
Jest Expect Message
Add custom message to Jest expects 🃏🗯
Stars: ✭ 240 (+1311.76%)
Mutual labels:  test
Jest Html Reporters
🌈 Reporter for jest test framework. 🌈
Stars: ✭ 245 (+1341.18%)
Mutual labels:  test
prismy
🌈 Simple and fast type safe server library for now.sh v2 and API routes of next.js.
Stars: ✭ 46 (+170.59%)
Mutual labels:  micro
Junit Dataprovider
A TestNG like dataprovider runner for JUnit with many additional features
Stars: ✭ 226 (+1229.41%)
Mutual labels:  test
api-with-express
🌈 API with Express
Stars: ✭ 25 (+47.06%)
Mutual labels:  test
Fsharp Hedgehog
Release with confidence, state-of-the-art property testing for .NET.
Stars: ✭ 219 (+1188.24%)
Mutual labels:  test
Opentest
Open source test automation tool for web applications, mobile apps and APIs
Stars: ✭ 246 (+1347.06%)
Mutual labels:  test
7182
Curso 7182 - Refatorando para testes de unidade
Stars: ✭ 21 (+23.53%)
Mutual labels:  test
Tablier
A micro-framework for Table Driven Tests.
Stars: ✭ 33 (+94.12%)
Mutual labels:  test
micro-superstruct
A Superstruct wrapper for Micro to validate your request body and query parameters
Stars: ✭ 15 (-11.76%)
Mutual labels:  micro

m.test

travis npm-dependencies standard-js npm-package-quality npm-node-version npm-version npm-license

m(icro)test is a lightweight test runner for node.js written in es6+ (~4kb).

donations

thanks for your support! gratipay

install

install m.test directly from npm to project's devDependencies.

npm install --save-dev m.test

usage

test files are run by simply passing them to node. for a given test/index.js run the following command to execute the suite:

node test

run the following one to enable node's debugger:

node debug test

cli

more utilities to run your suites are available through the cli. if no files are given they will be looked up from ./test recursively.

m.test [options] [files]

when executing suites through the cli m.test will be assigned to global.test by design. the following line can be omitted:

const {test} = require('m.test')

further instructions can be accessed via --help flag and man-pages by executing either m.test --help or man m.test within your shell.


basic usage

const {ok} = require('assert')

test('it just works!', function () {
  ok(true)
})

async usage

const {ok} = require('assert')

test('it works async too!', function (done) {
  setTimeout(function () {
    ok(true)
    done()
  }, 0)
})

test('done takes a error argument!', function (done) {
  setTimeout(function (err = null) {
    done(err)
  }, 0)
})

test('runner works with Promise', function (done) {
    let promise = new Promise(function (resolve, reject) {
      setTimeout(function () {
        resolve(true)
      }, 0)
    })

    promise.then(result => {
      ok(result)
      done()
    })
  })

context usage

test('can be used as a context', function () {
  test('works!', function (done) {
    done(null)
  })
  test('works!', function (done) {
    done(null)
  })
})

alias usage

const {test: context, test: describe, test: it} = require('m.test')

context('given some context', function () {
  describe('your subject', function () {
    it('just works!', (done) => done(null))
  })
})

beforeEach afterEach usage

test('description', function (done) {
  done(null)
})
beforeEach(done => setup(done))
afterEach(done => teardown(done))

it is important to call beforeEach and afterEach wrap functions after test functions themselves. when using wraps within nested suites consider their contextual binding.

test('description 1', function () {
  test('description 1.1', Function.prototype)
  test('description 1.2', Function.prototype)
  beforeEach(done => setup(done))
  afterEach(done => teardown(done))
})
test('description 2', function () {
  test('description 2.1', Function.prototype)
  test('description 2.2', Function.prototype)
})

(in the example above hooks would be called for 1.1 e 1.2)


skip modifier

test.skip('description', function () {
  // this function will never be called
})

the skip modifier comes with an optional doSkip=true parameter that enables/disables the skip behavior according to the expression:

test.skip('description', function () {
  // this test will be skipped when NODE_ENV=CI
}, /CI/gi.test(process.env.NODE_ENV))

timeout modifier

test.timeout('description', function () {
  // this test will fail if it exceeds 200ms of execution
}, 200)

the timeout modifier comes with an optional doTimeout=true parameter that enables/disables the timeout behavior according to the expression:

test.timeout('description', function () {
  // this test will have a timeout when NODE_ENV=CI
}, 200, /CI/g.test(process.env.NODE_ENV))

view more

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].