Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

grammarly/tape-enzyme

Repository files navigation

Tape-Enzyme

npm Version License Build Status

Tape-Enzyme is a micro library that helps you use tape with enzyme.

Installation

  • Use NPM:
npm i --save tape-enzyme

Usage

Tape-Enzyme is a proxy of tape, but it has better functionality.

Import library and use as tape test:

import test from 'tape-enzyme'

You can also add plugins to your current tape instance:

import test from 'tape'
import {registration} from 'tape-enzyme'

export default registration(test)

Use three types of testing utils:

  • Simple - common test methods
  • Enzyme - `enzyme test methods
  • Wrapper - new way of testing with tape

You can add your own methods using init:

.init(methodName, func)

  • @param { String } methodName
  • @param { Function } func

Example:

test.init('notStrictEqual', function (actual, expected, msg) {
  this.operator(actual, '!==', expected, msg)
})

test('notStrictEqual test', t => {
  t.notStrictEqual(3, '3', 'should be not strict equality')
  t.end()
})

Development

Prerequisites

  • You have node installed at v4.0.0+ and npm at v2.0.0+.
  • You are familiar with git.

Setup

$ git clone <this repo>
$ cd tape-enzyme
$ npm install

Tests

Linters:

$ npm run test:lint

Unit tests:

$ npm run test:unit

All tests:

$ npm run test

Contributing

The main purpose of this library is to make writing tests with tape easier. It involves less code while being more expressive and as robust as possible. If you think that we are missing any key features, please open a GitHub issue, or even better, a pull request. Any feedback you have about using tape-enzyme would be greatly appreciated.

License

Tape-enzyme is Apache 2.0 licensed.