mocha-test-runner-polymer

Runs a mocha test

Usage no npm install needed!

<script type="module">
  import mochaTestRunnerPolymer from 'https://cdn.skypack.dev/mocha-test-runner-polymer';
</script>

README

mocha-test-runner

Published on webcomponents.org npm version

A custom element for running mocha tests

How it works:

  • attaches events to local existing mocha instance

  • does not rely on the html reporter (unless you wish to do so)

  • uses events to communicate its state as well as the attributes running, and failed

  • Demo

  • API Docs

<html>
<head>
  <title>My test suite</title>
  <link rel="import" href="path/to/mocha-test/mocha-test-runner.html">
</head>
<body>
  <mocha-test-runner></mocha-test-runner>
</body>
</html>

Install

Install with either NPM or Bower:

npm install mocha-test-runner-polymer --save-dev
bower install sebs/mocha-test-runner --save-dev

Usage

Use webcomponentsjs to polyfill the web component APIs in incompatible browsers. Then use the <mocha-test> tag.

By default mocha-test assumes it is running within node_modules or bower_components and will find mocha in sibling folders.

ui

This attribute lets you control which user-interface is used. Either bdd, tdd or exports are valid options. bdd is the default.

<mocha-test-runner ui="tdd">...</mocha-test-runner>

License

MIT