3

I'm trying to setup testing environment with mocha and karma on top of that but I keep getting "Variable not found" from Karma when trying to run test where I use component that has the dependancy on "externals".

import RootComponent from 'src/RootComponent';
import moment from 'custom-moment';

webpack.config.js

webpack....
    externals: {
        'custom-moment' : 'UTIL.moment'
    }

UTILS is a global scope variable that moment is hooked on.

and everything runs but when I create then test file

root-test.js

import RootComponent from '../RootComponent'

and then write some describe and it() it fails and says "Variable not found" webpack/externals => UTIL.Moment

UTIL.Moment is done "out side" of Webpack. But it works on run time but not in the tests ?

Are there some babel-presets or config that I'm missing ?

ArniReynir
  • 849
  • 3
  • 12
  • 29

0 Answers0