'TypeError: modules[moduleId] is undefined

I am trying to run jasmine unit testing with Jenkins using Firefox browser on Linux and I keep having this behavior:

[32m02 08 2017 08:16:26.443:INFO [Firefox 50.0.0 (Windows 8.1 0.0.0)]:  [39mConnected on socket /#KYlvgi9JYtXnD1jZAAAB with id manual-931
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
  TypeError: modules[moduleId] is undefined
  at http://52.5.4.155:9876/_karma_webpack_/inline.bundle.js:55
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
  TypeError: modules[moduleId] is undefined
  at http://52.5.4.155:9876/_karma_webpack_/inline.bundle.js:55


[33m02 08 2017 08:21:27.750:WARN [Firefox 50.0.0 (Windows 8.1 0.0.0)]:  [39mDisconnected (1 times)
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
Disconnectedundefined
Firefox 50.0.0 (Windows 8.1 0.0.0) ERROR
Disconnectedundefined

The exception is on this Line of code:

// Execute the module function
/******/        modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

I research a lot about the issue, but I couldn't find any solution. Is there anyone that can help me to solve it.



Solution 1:[1]

I faced same issue and found that in Karma.conf.js, I was using wrong configuration for "files" as

module.exports = function (config) {
config.set({
    basePath: '.',
    frameworks: ['jasmine'],
    files: [
        '../../ClientApp/dist/vendor.js',
        './boot-tests.ts'
    ],

Modified this to target only files which contain unit tests as

module.exports = function (config) {
config.set({
    basePath: '.',
    frameworks: ['jasmine'],
    files: [
        '../../ClientApp/**/*.spec.ts'
    ],

and now I don't get this error. Though something else going wrong in my tests so getting other errors but seems this specific issue resolved.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mogsdad