Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

Commit dcb74a5

Browse files
fix: handle non existing mochaConfig
1 parent 0122080 commit dcb74a5

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

karma.conf.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ module.exports = function (config) {
99

1010
browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'],
1111

12-
autoWatch: true
12+
autoWatch: true,
13+
14+
plugins: [
15+
require.resolve('./'),
16+
'karma-chai',
17+
'karma-sinon',
18+
'karma-firefox-launcher',
19+
'karma-chrome-launcher'
20+
]
1321
})
1422
}

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var initMocha = function (files, mochaConfig) {
88
var mochaPath = path.dirname(require.resolve('mocha'))
99
files.unshift(createPattern(path.join(__dirname, 'adapter.js')))
1010

11-
if (mochaConfig.require && mochaConfig.require.map) {
11+
if (mochaConfig && mochaConfig.require && mochaConfig.require.map) {
1212
mochaConfig.require.map(function (requirePath) {
1313
return files.unshift(createPattern(requirePath))
1414
})

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@
3434
"grunt-eslint": "^18.0.0",
3535
"grunt-karma": "2.x",
3636
"grunt-npm": "~0.0.2",
37-
"karma": "1.x || ^0.13.15",
38-
"karma-chai": "1.x || ~0.1.0",
39-
"karma-chrome-launcher": "1.x || ^0.2.1",
40-
"karma-firefox-launcher": "1.x || ~0.1.0",
41-
"karma-mocha": "1.x || ~0.2.1",
42-
"karma-sinon": "1.x || ~1.0.3",
37+
"karma": "^1.0.0",
38+
"karma-chai": "^0.1.0",
39+
"karma-chrome-launcher": "^1.0.0",
40+
"karma-firefox-launcher": "^1.0.0",
41+
"karma-sinon": "^1.0.3",
4342
"load-grunt-tasks": "^3.2.0",
4443
"mocha": "^2.4.5",
4544
"shared-karma-files": "git://github.com/karma-runner/shared-karma-files.git#82ae8d02",

0 commit comments

Comments
 (0)