4

I have this:

import assert from 'assert'; import foo from './foo'; describe('Array', function() { 

but when running karma I get the error require is not defined even when not using require.

any ideas?

module.exports = function (config) { config.set({ basePath: '', frameworks: ['mocha'], files: [ 'src/**/*spec.js' ], exclude: [], preprocessors: { 'src/**/*.js': ['babel'] }, reporters: ['progress'], 
3
  • The preprocessors definition (src/**/*.js) will also preprocess third-party libraries, which may cause the problem. Commented Nov 15, 2016 at 12:51
  • And how should this config know to transpile the es6 to es5? You need a babelPreprocessor config for this. Commented Nov 15, 2016 at 12:53
  • @NielsSteenbeek I have a .babelrc { "presets": ["es2015"] }, I don't have 3rd party in source. Commented Nov 15, 2016 at 15:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.