Last active
November 15, 2015 19:22
-
-
Save orbitbot/f485a90f1c668ef7e583 to your computer and use it in GitHub Desktop.
karma-electron-launcher issue with require
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var KarmaServer = require('karma').Server; | |
new KarmaServer({ | |
browsers: ['Electron'], | |
colors : true, | |
files: [ | |
'working-shim.js', | |
'test.js', | |
], | |
frameworks: ['mocha'], | |
reporters: ['mocha'], | |
plugins: [ | |
'karma-mocha', | |
'karma-mocha-reporter', | |
'karma-electron-launcher' | |
], | |
singleRun: true | |
}).start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "f485a90f1c668ef7e583", | |
"version": "0.0.0", | |
"description": "https://github.com/lele85/karma-electron-launcher/issues/7", | |
"main": "index.js", | |
"repository": { | |
"type": "git", | |
"url": "https://orbitbot@gist.github.com/f485a90f1c668ef7e583" | |
}, | |
"devDependencies": { | |
"karma-mocha": "~0.2.0", | |
"karma-electron-launcher": "0.0.3", | |
"karma-mocha-reporter": "~1.1.1", | |
"mocha": "~2.3.3", | |
"karma": "~0.13.15", | |
"electron-prebuilt": "~0.34.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this helper exposes require inside mocha tests run with karma | |
global = window.parent; | |
process = window.process || window.parent.process; | |
require = window.require || window.parent.require; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Electron browser', function() { | |
it('can require core modules', function() { | |
var util = require('util'); | |
console.info(util.inspect({ util: true })); | |
}); | |
it('should be able to require mocha since it\'s in package.json', function() { | |
var mocha = rRequire('mocha'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this helper exposes require inside mocha tests run with karma | |
global = window.parent; | |
process = window.process || window.parent.process; | |
require = window.require || window.parent.require; | |
// allow require to work on non-core modules | |
rRequire = require('remote').require; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment