0.0.16 • Published 10 months ago
boxtape v0.0.16
📦 boxtape
This is just regular tape, but with some quality of life improvements for the ESM era.
Usage
See tape.
npm install boxtape
# If you use typescript:
npm install @types/tape
boxtape tests/**/*.js
import test from 'boxtape'
Additions
beforeEach
import test from 'boxtape'
test.beforeEach(async (t) => {
// Do something before each test.
})
afterEach
import test from 'boxtape'
test.afterEach(async (t) => {
// Do something after each test.
})
Default TAP Output Formatter
This uses a fork of tap-pretty
to provide a nice output by default. The fork has added error stack trace so that you can navigate to where the error occurred.
Since boxtape
automatically pipes tape
output into tap-pretty
, you cannot pipe into your own tap formatter.
Examples
Frontend Testing
Here is a simple example to get you started for frontend testing.
// In this example, we are doing some frontend testing.
import test from 'boxtape'
import sinon from 'sinon'
import {JSDOM} from 'jsdom'
// Load DOM functions:
const dom = new JSDOM()
global.document = dom.window.document
global.window = dom.window
sinon.spy(document)
test.beforeEach(() => {
// Maybe you want to reset your spy counts:
for (const method in document) {
if (typeof document[method] === 'function') {
if (document[method].callCount !== undefined) {
document[method].callCount = 0
}
}
}
})
0.0.13
10 months ago
0.0.14
10 months ago
0.0.15
10 months ago
0.0.16
10 months ago
0.0.12
10 months ago
0.0.11
10 months ago
0.0.10
10 months ago
0.0.9
10 months ago
0.0.8
10 months ago
0.0.7
10 months ago
0.0.6
10 months ago
0.0.5
10 months ago
0.0.4
10 months ago
0.0.3
10 months ago
0.0.2
10 months ago
0.0.1
10 months ago
0.0.0
10 months ago