matthewp / mocha-test

A custom element for running mocha/chai tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mocha-test

A custom element for running mocha and chai chai tests, where each HTML file is a separate test suite.

<html>
<head>
  <title>My test suite</title>
  <link rel="import" href="path/to/mocha-test/mocha-test.html">
</head>
<body>
  <mocha-test>
    <template>
      <script>
        describe('Running tests', function(){
          it('has never been this easy!', function(){
            assert.ok(true);
          });
        });
      </script>
    </template>
  </mocha-test>
</body>
</html>

Install

Install with either NPM or Bower:

npm install mocha-test --save-dev
bower install mocha-test --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 and chai in sibling folders.

mocha-path and chai-path

If you have put mocha-test.html somewhere else, or your versions of mocha/chai are in non-standard locations you can customize their path with these attributes:

<mocha-test mocha-path="./lib/mocha" chai-path="./lib/chai">
  ...
</mocha-test>

Note that this is the path to the mocha/chai folder, not their JavaScript files.

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 ui="tdd">...</mocha-test>

License

BSD 2 Clause

About

A custom element for running mocha/chai tests


Languages

Language:HTML 100.0%