Dieses Blog durchsuchen

Dienstag, 6. Dezember 2016

ES6 unittests with jest-cli

After 2 days fighting with babel and mocha , I couldnt figure out why none of my module exports worked.

Now I found jest-cli on a video on Egghead.io with Kent C. Dodds, which does the job of my unittest of ES6 classes.

1) install npm dependencies. Download package.json and run npm install

2) save .babelrc with following content in the root of your project:


3) save following content to your root as sum.js
   
4) save following content to your root as sum.test.js

5) run npm test

That`s all. Now you are able to test ES6 classes. Here are the souces on github: https://github.com/pboethig/unittest-es6-javascript

Keine Kommentare:

Kommentar veröffentlichen