Closed Elhebert closed 7 years ago
@Elhebert It seems like you need to use karma-browserify
in the plugins
property.
Your plugins section needs to look like this:
plugins: [
'karma-browserify'
],
Did you come across the solution mentioned in this comment : https://github.com/nikku/karma-browserify/issues/96#issuecomment-73027261
In case your plugins section already has some other entries, just add karma-browserify
to the plugins
array along with existing items.
Please let me know how this goes
@vivganes Thanks for your reply but as I explained I already tried that. Didn't worked.
I'm still trying to figure it out, but so far, haven't found any solution.
@Elhebert Is it possible for you to post the full karma.config.js
(after masking any sensitive information)?
This will help in understanding some more about your situation
@vivganes Sure, not a problem:
// Karma configuration
// Generated on Tue Nov 22 2016 10:00:32 GMT+0100 (CET)
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: ['mocha', 'browersify'],
browserify: {
debug: true,
transform: [
['babelify', { plugin: ["babel-plugin-es2015"] }]
],
extension: ['.js']
},
// list of files / patterns to load in the browser
files: [
'src/**/**.spec.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: {
'src/**/**.spec.js': ['browserify']
},
// 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_DEBUG,
// 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', 'Safari', 'Firefox'],
// 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,
})
}
As I stated before, I tried to add the plugins array with karma-browserify, but it didn't help.
@Elhebert you have a typo in word 'browserify'.
X - browersify
V - browserify
@maksimr OMG, I'm going to hang myself...
Thanks !
@Elhebert me too...
I'm trying to use karma to run my tests, and encounter some strange error.
I'm running everything locally, and don't have karma installed globally.
As you can see in the debug logs, all the plugins are loaded correctly. I have made some research here and on SO before posting, and tried every solution I found, but (obviously) none worked:
karma-cli
globally.But still got the same issue. However, the issue varies sometimes:
If I add
plugins: ['karma-browserify']
to my config file, it return meBut when I add
plugins: ['karma-browserify', 'karma-mocha']
, it return mewhich is pretty weird.
So I'm open to suggestions :)
Actual behaviour
Environment Details
karma.config.js
file:browserify: { debug: true, transform: [ ['babelify', { plugin: ["babel-plugin-es2015"] }] ], extension: ['.js'] },