Running Mocha tests in the browser with ES6 Modules support
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
.editorconfig init Dec 4, 2017
.gitignore init Dec 4, 2017
README.md readme: instructions for running locally, fixes #2 Mar 28, 2018
bundle.js ready Dec 6, 2017
index.html ready Dec 6, 2017
package-lock.json ready Dec 6, 2017
package.json ready Dec 6, 2017
run.js ready Dec 6, 2017
setup.js ready Dec 6, 2017
sum.js ready Dec 6, 2017
sum.test.js ready Dec 6, 2017
webpack.config.js ready Dec 6, 2017

README.md

Mocha ES6 modules example

An example of running Mocha tests as a native ES6 modules in a browser.

  • If browser supports ES6 modules — the are used. 
  • If browser does not support ES6 modules — the page fallbacks to bundled script.

You can check it online in your browser.

With ES modules (Chrome >= 62):

Mocha tests With ES modules

Without ES modules (Firefox 57):

Mocha tests Without ES modules

Run locally

  1. Clone the repo:
    git clone https://github.com/vitalets/mocha-es6-modules.git
    cd mocha-es6-modules
  2. Install dependencies:
    npm install
  3. Build non-es6 version:
    npm run build
  4. Start local http server:
    npm run server
  5. Open http://localhost:8000 in browser.