Skip to content

Commit

Permalink
Merge pull request #368 from felixrieseberg/fix-electron3
Browse files Browse the repository at this point in the history
Fix for testing against electron 3 on windows
  • Loading branch information
Ben Demboski authored Oct 5, 2018
2 parents a33e7e7 + 5d25981 commit c475eb2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 2 additions & 10 deletions blueprints/ember-electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,10 @@ module.exports = class EmberElectronBlueprint extends Blueprint {

logger.startProgress('Installing electron build tools');

return npmInstall.run({
// FIXME: Something seems to break in Windows with electron v3.0.0
// This is a hack to make electron-forge install electron 2.x instead of 'latest' (3.x) into the project
// See https://github.com/electron-userland/electron-forge/blob/5.x/src/api/import.js#L179
save: true,
verbose: false,
packages: ['[email protected]'],
})
.then(() => efImport({
return efImport({
updateScripts: false,
outDir: 'electron-out',
}))
})
.then(() => npmInstall.run({
'save-dev': true,
verbose: false,
Expand Down
2 changes: 1 addition & 1 deletion lib/test-support/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let mainWindow = null;
// The testUrl is a file: url pointing to our index.html, with some query
// params we need to preserve for testem. So we need to register our ember
// protocol accordingly.
let [, , indexUrl, testemUrl] = process.argv;
let [, , , indexUrl, testemUrl] = process.argv;
// Undo workaround for windows (see test-runner.js for explanation)
indexUrl = indexUrl.replace(/__amp__/g, '&');
let {
Expand Down
10 changes: 9 additions & 1 deletion lib/test-support/test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ if (require.main === module) {
testUrl = testUrl.replace(/&/g, '__amp__');

// Start electron
efStart({ appPath: buildDir, dir: buildDir, args: [testUrl, testemUrl] }).then(({ pid }) => {
efStart({
appPath: buildDir,
dir: buildDir,
args: [
'--', // needed because https://github.com/electron/electron/pull/13039
testUrl,
testemUrl,
],
}).then(({ pid }) => {
// Clean up when we're killed
process.on('SIGTERM', () => {
treeKill(pid);
Expand Down

0 comments on commit c475eb2

Please sign in to comment.