Karma machine does not work

I used Karma about a year ago, and everything worked fine. When I changed the tests and saved the .test.js file, the autostart test - there was no need to restart or change anything. Today I wanted to run these tests again. Having a new computer, I had to install node and npm and something else, and then I also installed:

npm install -g karma karma-cli karma-jasmine karma-chrome-launcher

I configured Karma as follows ( karma init ):

  // Karma configuration // Generated on Thu Apr 14 2016 14:50:35 GMT+0200 (Central Europe Summer Time) 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://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ 'js/*.js' ], // list of files to exclude exclude: [ ], // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter reporters: ['progress'], // web server port port: 9876, // enable / disable colors in the output (reporters and logs) colors: true, // level of logging // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG logLevel: config.LOG_INFO, // enable / disable watching file and executing tests whenever any file changes autoWatch: true, // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher browsers: ['Chrome'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: false, // Concurrency level // how many browser should be started simultaneous concurrency: Infinity }) } 

When I start karma ( karma start karma.conf.js ), a new chrome tab opens with the port specified in the configuration file. The test passed, everything worked as expected. However, when I changed something in the .test.js file, Karma did not start automatically. Actually, there were no changes. I had to restart Karma in CMD and run again to see new results.

However, if I open a new CMD and execute karma run , the test is updated. So the part that keeps track of the changes doesn't work, obviously.

So, I have no idea what I'm missing here, but the Karma auto-view feature no longer works. Any suggestions I should start with?

+5
source share
1 answer

I just found a fix after several months of searching.

I am sure there are other ways to disable the cache in chrome. But it worked for me right away.

After entering karma start and starting chrome, enable the developer tools and the network tab, check disable cache

+3
source

Source: https://habr.com/ru/post/1247132/


All Articles