tapeless

Helps with tape like testing

Usage no npm install needed!

<script type="module">
  import tapeless from 'https://cdn.skypack.dev/tapeless';
</script>

README

about

A test harness that is smaller than tape and can be used in-browser directly.

setup

Download from the npm registry for Node.js:

# Add to package.json
npm install tapeless --save-dev

Source from an import map for Deno:

{
  "imports": {
    "likewise": "https://cdn.jsdelivr.net/npm/likewise@latest/main.js",
    "tapeling": "https://cdn.jsdelivr.net/npm/tapeling@latest/main.js"
  }
}

usage

The assertions provided are ok() and equal() plus counterparts. Add kpow and cutaway to run browser-side. For example, given a test script like:

// Sample test.js
import "cutaway"
import { assert, report } from "tapeless"

const { equal: same, ok } = assert

const sample = { a: "a", b: "b" }
const id = (input = sample) => input

same.test(typeof id, "function")
ok.test(sample)
same.test(sample, id())

report()

Bundling along the lines of:

npx -p kpow -p rollup -p @rollup/plugin-node-resolve -c \
'rollup -p node-resolve -f iife test.js | kpow'

Produces the following report:

TAP in HTML sample

see also