karma-runner / karma-commonjs

A Karma plugin. Test CommonJS modules.
MIT License
73 stars 30 forks source link

Jasmine Uncaught ReferenceError: jasmineRequire is not defined #69

Open sashokbg opened 2 years ago

sashokbg commented 2 years ago

Hello,

I am trying to make karma-commonjs work with jasmine and I get the following error on a very basic example:

Uncaught ReferenceError: jasmineRequire is not defined
  at node_modules/karma-jasmine/lib/boot.js:14:17

  ReferenceError: jasmineRequire is not defined
      at node_modules/karma-jasmine/lib/boot.js:14:17
      at window.__cjs_module__./home/alexander/projects/karma-test/node_modules/karma-jasmine/lib/boot.js (node_modules/karma-jasmine/lib/boot.js:43:2)
      at runModule (node_modules/karma-commonjs/client/commonjs_bridge.js:40:5)
      at require (node_modules/karma-commonjs/client/commonjs_bridge.js:79:14)
      at node_modules/karma-commonjs/client/commonjs_bridge.js:141:13
      at node_modules/karma-commonjs/client/commonjs_bridge.js:145:3

Here is my karma.config.js

module.exports = function (config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter
    frameworks: ['commonjs', 'jasmine'],

    // list of files / patterns to load in the browser
    files: [
      {pattern: 'lib/**/*.js', included: false},
      {pattern: 'src/**/*.js', included: false},
      {pattern: 'test/**/*spec.js', included: false}
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor
    preprocessors: {
      '**/*.js': ['commonjs']
    },

    browsers: ['ChromeHeadless'],
  })
}

Any help is greatly appreciated. Thank you Regards Alex