@redsift/tape-reel

Tape + JSDOM + CircleCI

Usage no npm install needed!

<script type="module">
  import redsiftTapeReel from 'https://cdn.skypack.dev/@redsift/tape-reel';
</script>

README

tape-reel

Circle CI npm MIT

Simple tape wrapper to better integrate server side JSDOM testing and CircleCI.

Usage

Where you typically use Tape e.g.

var tape = require("tape");

Simply

var tape = require("@redsift/tape-reel")("<div id='test'></div>");

The HTML sets the JSDOM for environment for each test invocation. This document is provided in the global scope for easy integration with browser JavaScript components and passed as the second parameter to the function under test.

Features

Compared to a naked Tape setup, this wrapper provides the following pre-configurations:

  1. Setup and teardown a fresh JSDOM for each test.
  2. When run on CircleCI, produce a JUnit.xml compatible output in $CIRCLE_TEST_REPORTS/junit/junit.xml.
  3. When not run on CircleCI, pretty print with tap-diff and dump the DOM for failing tests. You may manually get a string representation of the DOM using tape.dumpJSDOM(document).

Options

var tape = require("@redsift/tape-reel")(JSDOM-HTML, SUPRESS-DOM, REPORT-NAME);
Parameter Purpose Default
JSDOM-HTML May be null if no JSDOM environment is required null
SUPRESS-DOM By default, a failing test will dump the state of the DOM false
REPORT-NAME Names the test report when generating junit.xml files on CircleCI junit

Known Issues

Currently, REPORT-NAME does not produce multiple junit.xml files due to a bug in the imported tap-xunit module.