lundi 25 janvier 2016

Mocha Tests with Webpack Feature Flags

we've been using webpack for a while now and recently started using feature flags:

plugins: [
    new webpack.DefinePlugin({ __DEV__: true })
],

We are using mocha for our unit tests:

"scripts": {
    "test": "mocha --compilers js:babel-register --check-leaks --throw-deprecation --recursive Source/test",
    "test:watch": "npm test -- --watch"
},

The Problem is that mocha cannot handle them and I have found no way of faking them:

ReferenceError: __DEV__ is not defined

Is there any way to make this work?

Any way to tell mocha to inject the flags the same way webpack does?

Aucun commentaire:

Enregistrer un commentaire