lundi 7 décembre 2015

Writing unit tests using browserify + babel + mocha

I'm writing a Javascript application using browserify and babel to support ECMAScript 6. I want to write unit tests for it. This application has Web APIs dependencies like DOMParser and XMLHttpRequest.

I've tried the following to write proper unit tests:

  1. headless mode using sinon.JS and mocha CLI. Result: it didn't meet my needs because I would have to write many mocks for Web API;

  2. mochify with PhantomJS: slow, and I couldn't get to work with accepting new keywords such as Promise. This is how I ran my test: ./node_modules/.bin/mochify --transform babelify

Any ideas on what I should use to write proper unit tests using the technologies I'm using? Maybe a github example of such scenario?

Aucun commentaire:

Enregistrer un commentaire