Skip to content

Commit 5323706

Browse files
committed
test: fix running electron-mocha tests on Windows
1 parent 028169e commit 5323706

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
"overrides": {
6464
"typescript": "~4.9.5",
6565
"node-gyp": "10.0.1"
66+
},
67+
"patchedDependencies": {
68+
"electron-mocha": "patches/electron-mocha.patch"
6669
}
6770
},
6871
"engines": {

patches/electron-mocha.patch

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/bin/electron-mocha b/bin/electron-mocha
2+
index 038b2a00322cfaf98824ff33729b917c80d12828..30ed87458181ae7b7efe2970726b2eedd25f2138 100755
3+
--- a/bin/electron-mocha
4+
+++ b/bin/electron-mocha
5+
@@ -35,7 +35,7 @@ function run (electron) {
6+
...process.argv.slice(2)
7+
]
8+
9+
- let child = spawn(electron, args)
10+
+ let child = spawn(electron, args, { shell: process.platform === 'win32' })
11+
12+
// stdio 'inherit' not work reliably in Renderer!
13+
child.stdout.pipe(process.stdout)
14+
diff --git a/lib/main.js b/lib/main.js
15+
index b8d0f8e80a86318d2a90fac3332514adda379ad9..0e1d55c3a996ddf0b5c8d98da8f04339da34788d 100644
16+
--- a/lib/main.js
17+
+++ b/lib/main.js
18+
@@ -54,7 +54,8 @@ app.on('quit', () => {
19+
detached: true,
20+
stdio: 'ignore',
21+
env: { ELECTRON_RUN_AS_NODE: 1 },
22+
- cwd: __dirname
23+
+ cwd: __dirname,
24+
+ shell: process.platform === 'win32'
25+
})
26+
child.unref()
27+
})

pnpm-lock.yaml

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)