Skip to content

Instantly share code, notes, and snippets.

@orbitbot
Last active November 15, 2015 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orbitbot/f485a90f1c668ef7e583 to your computer and use it in GitHub Desktop.
Save orbitbot/f485a90f1c668ef7e583 to your computer and use it in GitHub Desktop.
karma-electron-launcher issue with require
node_modules
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();
{
"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 helper exposes require inside mocha tests run with karma
global = window.parent;
process = window.process || window.parent.process;
require = window.require || window.parent.require;
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 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