electron-mocha
Advanced tools
Comparing version 9.0.0 to 9.0.1
<!-- Github links generated with: https://github.com/jprichardson/issue-links --> | ||
9.0.1 / 2020-07-07 | ||
------------------ | ||
- Fix --require handling in Mocha 8.x | ||
9.0.0 / 2020-07-07 | ||
@@ -3,0 +7,0 @@ ------------------ |
@@ -18,6 +18,6 @@ 'use strict' | ||
const runMocha = (argv, done) => { | ||
const runMocha = async (argv, done) => { | ||
Error.stackTraceLimit = Infinity | ||
handleRequires(argv.require) | ||
await handleRequires(argv.require) | ||
validatePlugin(argv, 'reporter', Mocha.reporters) | ||
@@ -29,6 +29,6 @@ validatePlugin(argv, 'ui', Mocha.interfaces) | ||
if (argv.watch) { | ||
watchRun(mocha, { ui: argv.ui }, argv) | ||
await watchRun(mocha, { ui: argv.ui }, argv) | ||
} else { | ||
mocha.files = collectFiles(argv) | ||
mocha.run(done) | ||
await mocha.run(done) | ||
} | ||
@@ -35,0 +35,0 @@ } |
140
lib/run.js
@@ -29,2 +29,3 @@ 'use strict' | ||
case 'check': | ||
case 'middleware': | ||
result = obj | ||
@@ -115,4 +116,2 @@ break | ||
helpers.handleRequires(argv['require-main']) | ||
return true | ||
@@ -122,81 +121,82 @@ }) | ||
exports.handler = argv => { | ||
whenReady | ||
.then(() => { | ||
powerSaveBlocker.start('prevent-app-suspension') | ||
exports.handler = async argv => { | ||
try { | ||
await helpers.handleRequires(argv['require-main']) | ||
await whenReady | ||
if (process.platform === 'darwin') { | ||
if (!(argv.inspect && argv.renderer)) { | ||
app.dock.hide() | ||
} | ||
powerSaveBlocker.start('prevent-app-suspension') | ||
if (process.platform === 'darwin') { | ||
if (!(argv.inspect && argv.renderer)) { | ||
app.dock.hide() | ||
} | ||
} | ||
let code = 0 | ||
let code = 0 | ||
process.on('SIGINT', () => app.exit(code)) | ||
process.on('SIGTERM', () => app.exit(code)) | ||
process.on('SIGINT', () => app.exit(code)) | ||
process.on('SIGTERM', () => app.exit(code)) | ||
if (!argv.renderer) { | ||
helpers.runMocha(argv, count => { | ||
code = Math.min(count, 255) | ||
if (!argv.watch) { | ||
app.exit(code) | ||
} | ||
}) | ||
} else { | ||
const win = createWindow({ | ||
height: 700, | ||
width: 1200, | ||
focusable: argv.inspect, | ||
webPreferences: { | ||
enableRemoteModule: true, | ||
contextIsolation: false, | ||
nodeIntegration: true, | ||
webSecurity: false | ||
} | ||
}) | ||
if (!argv.renderer) { | ||
await helpers.runMocha(argv, count => { | ||
code = Math.min(count, 255) | ||
if (!argv.watch) { | ||
app.exit(code) | ||
} | ||
}) | ||
} else { | ||
const win = createWindow({ | ||
height: 700, | ||
width: 1200, | ||
focusable: argv.inspect, | ||
webPreferences: { | ||
enableRemoteModule: true, | ||
contextIsolation: false, | ||
nodeIntegration: true, | ||
webSecurity: false | ||
} | ||
}) | ||
win.webContents.on('destroyed', () => app.exit(code)) | ||
win.webContents.on('destroyed', () => app.exit(code)) | ||
ipc.on('mocha-done', (event, count) => { | ||
code = Math.min(count, 255) | ||
if (!(argv.interactive || argv.watch)) { | ||
if (!win.isDestroyed()) win.close() | ||
} | ||
}) | ||
ipc.on('mocha-done', (event, count) => { | ||
code = Math.min(count, 255) | ||
if (!(argv.interactive || argv.watch)) { | ||
if (!win.isDestroyed()) win.close() | ||
} | ||
}) | ||
ipc.on('mocha-error', (_, error) => { | ||
win.webContents.removeAllListeners('destroyed') | ||
fail(error, argv['full-trace']) | ||
}) | ||
ipc.on('mocha-warn', (_, warning) => warn(warning)) | ||
ipc.on('mocha-error', (_, error) => { | ||
win.webContents.removeAllListeners('destroyed') | ||
fail(error, argv['full-trace']) | ||
}) | ||
ipc.on('mocha-warn', (_, warning) => warn(warning)) | ||
// Undocumented call in electron-window | ||
win._loadURLWithArgs( | ||
join(__dirname, '../renderer/index.html'), | ||
argv, | ||
() => { | ||
if (argv.inspect) { | ||
win.show() | ||
win.webContents.openDevTools() | ||
win.webContents.on('devtools-opened', () => { | ||
// Debugger is not immediately ready! | ||
setTimeout(() => { | ||
win.webContents.send('mocha-start') | ||
}, 250) | ||
}) | ||
// Undocumented call in electron-window | ||
win._loadURLWithArgs( | ||
join(__dirname, '../renderer/index.html'), | ||
argv, | ||
() => { | ||
if (argv.inspect) { | ||
win.show() | ||
win.webContents.openDevTools() | ||
win.webContents.on('devtools-opened', () => { | ||
// Debugger is not immediately ready! | ||
setTimeout(() => { | ||
win.webContents.send('mocha-start') | ||
}, 250) | ||
}) | ||
// Called on reload in --interactive mode | ||
ipc.on('mocha-ready-to-run', () => { | ||
win.webContents.send('mocha-start') | ||
}) | ||
} else { | ||
// Called on reload in --interactive mode | ||
ipc.on('mocha-ready-to-run', () => { | ||
win.webContents.send('mocha-start') | ||
} | ||
}) | ||
} | ||
}) | ||
.catch((err) => { | ||
fail(err, argv['full-trace']) | ||
}) | ||
}) | ||
} else { | ||
win.webContents.send('mocha-start') | ||
} | ||
}) | ||
} | ||
} catch (err) { | ||
fail(err, argv['full-trace']) | ||
} | ||
} | ||
@@ -203,0 +203,0 @@ |
{ | ||
"name": "electron-mocha", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"description": "Mocha tests in Electron.", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
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
36550