0
votes

Error image

I was doing jasmine karma unit testing using angular and i received this error. Please help

This is my karma.conf.js

Karma. conf.js

// Karma configuration file, see link for more information //<br> https://karma-runner.github.io/1.0/config/configuration-file.html<br>

module.exports = function (config) {   config.set({<br>
    basePath: '',<br>
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [<br>
      require('karma-jasmine'),<br>
      require('karma-chrome-launcher'),<br>
      require('karma-jasmine-html-reporter'),<br>
      require('karma-coverage-istanbul-reporter'),<br>
      require('@angular-devkit/build-angular/plugins/karma')<br>
    ],<br>
    client: {<br>
      clearContext: false // leave Jasmine Spec Runner output visible in browser<br>
    },
    coverageIstanbulReporter: {<br>
      dir: require('path').join(__dirname, './coverage/Certification-Portal'),<br>
      reports: ['html', 'lcovonly', 'text-summary'],<br>
      fixWebpackSourcePaths: true<br>
    },<br>
    reporters: ['progress', 'kjhtml'],<br>
    port: 9876,
    colors: true,<br>
    logLevel: config.LOG_INFO,<br>
    autoWatch: true,<br>
    browsers: ['Chrome'],<br>
    singleRun: false,<br>
    restartOnFileChange: true   }); };<br>
1

1 Answers

1
votes

Find the file which is throwing this error, and go to index.js of the same file and remove 'module.' in that. It'll work while you are testing the application. Please do add it when you are done with the unit testing.

NOTE: You'll find the file in node modules only. For exact file name refer to the console error message, it'll show you the path of error causing file.