electron-mocha
Advanced tools
Comparing version 0.6.3 to 0.7.0
13
args.js
var fs = require('fs') | ||
var path = require('path') | ||
var program = require('commander') | ||
var join = path.join | ||
var resolve = path.resolve | ||
var cwd = process.cwd() | ||
function parse (argv) { | ||
var globals = [] | ||
var requires = [] | ||
@@ -36,7 +40,8 @@ program._name = 'electron-mocha' | ||
module.paths.push(process.cwd(), path.join(process.cwd(), 'node_modules')) | ||
module.paths.push(cwd, join(cwd, 'node_modules')) | ||
program.on('require', function (mod) { | ||
var abs = fs.existsSync(mod) || fs.existsSync(mod + '.js') | ||
if (abs) mod = path.resolve(mod) | ||
require(mod) | ||
if (abs) mod = resolve(mod) | ||
requires.push(mod) | ||
}) | ||
@@ -48,2 +53,4 @@ | ||
argData.require = requires | ||
// delete unused | ||
@@ -50,0 +57,0 @@ ;['commands', 'options', '_execs', '_args', '_name', '_events', '_usage', '_version', '_eventsCount', 'args'].forEach(function (key) { |
@@ -0,1 +1,7 @@ | ||
0.7.0 / 2015-12-15 | ||
------------------ | ||
- update `electron-window` dep. (For electron >= `0.35`). Removes deprecation warnings. See: https://github.com/jprichardson/electron-mocha/pull/31 | ||
- clean up require statements (Electron modules). See: https://github.com/jprichardson/electron-mocha/pull/29 | ||
- `--require` support fixed in Renderer. See: https://github.com/jprichardson/electron-mocha/pull/33 | ||
0.6.3 / 2015-11-26 | ||
@@ -2,0 +8,0 @@ ------------------ |
16
index.js
@@ -11,11 +11,8 @@ var fs = require('fs-extra') | ||
var ipc | ||
// Check if electron version is >0.35.0 | ||
var electronV = process.versions['electron'].split('.') | ||
if (parseInt(electronV[1], 10) >= 35 && electronV[0] === '0') { | ||
var electron = require('electron') | ||
ipc = electron.ipcMain | ||
app = electron.app | ||
} else { | ||
try { | ||
app = require('electron').app | ||
ipc = require('electron').ipcMain | ||
} catch (e) { | ||
app = require('app') | ||
ipc = require('ipc') | ||
app = require('app') | ||
} | ||
@@ -45,2 +42,5 @@ | ||
if (!opts.renderer) { | ||
opts.require.forEach(function (mod) { | ||
require(mod) | ||
}) | ||
mocha.run(opts, exit) | ||
@@ -47,0 +47,0 @@ } else { |
{ | ||
"name": "electron-mocha", | ||
"version": "0.6.3", | ||
"version": "0.7.0", | ||
"description": "Mocha tests in Electron.", | ||
"preferGlobal": true, | ||
"main": "index.js", | ||
@@ -36,3 +35,3 @@ "scripts": { | ||
"commander": "^2.8.1", | ||
"electron-window": "^0.5.0", | ||
"electron-window": "^0.6.0", | ||
"fs-extra": "^0.22.1", | ||
@@ -39,0 +38,0 @@ "mocha": "2.2.5", |
var remote | ||
// Check if electron version is >0.35.0 | ||
var electronV = process.versions['electron'].split('.') | ||
if (parseInt(electronV[1], 10) >= 35 && electronV[0] === '0') { | ||
var electron = require('electron') | ||
remote = electron.remote | ||
} else { | ||
try { | ||
remote = require('electron').remote | ||
} catch (e) { | ||
remote = require('remote') | ||
@@ -9,0 +6,0 @@ } |
require('./console') | ||
var mocha = require('../mocha') | ||
var ipc | ||
// Check if electron version is >0.35.0 | ||
var electronV = process.versions['electron'].split('.') | ||
if (parseInt(electronV[1], 10) >= 35 && electronV[0] === '0') { | ||
var electron = require('electron') | ||
ipc = electron.ipcMain | ||
} else { | ||
try { | ||
ipc = require('electron').ipcRenderer | ||
} catch (e) { | ||
ipc = require('ipc') | ||
@@ -25,5 +22,11 @@ } | ||
// console.log(JSON.stringify(window.__args__, null, 2)) | ||
mocha.run(window.__args__, function (failureCount) { | ||
var opts = window.__args__ | ||
// console.log(JSON.stringify(opts, null, 2)) | ||
opts.require.forEach(function (mod) { | ||
require(mod) | ||
}) | ||
mocha.run(opts, function (failureCount) { | ||
ipc.send('mocha-done', failureCount) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15691
249
5
+ Addedelectron-window@0.6.4(transitive)
- Removedelectron-window@0.5.0(transitive)
Updatedelectron-window@^0.6.0