aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-03 19:47:39 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-16 00:55:02 +0200
commitd2aa484b600dc0d122bb994b9bb29504ffe4cf12 (patch)
tree1d3e38fdb22f7afe02f1ebcf4b07734761970985 /scripts
parentrefactor: config file saving and debugging (diff)
downloadsophie-d2aa484b600dc0d122bb994b9bb29504ffe4cf12.tar.gz
sophie-d2aa484b600dc0d122bb994b9bb29504ffe4cf12.tar.zst
sophie-d2aa484b600dc0d122bb994b9bb29504ffe4cf12.zip
build: integration testing support
Run integration tests in an electron environment for the main process. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/electronJest.cjs12
-rw-r--r--scripts/watch.js5
2 files changed, 16 insertions, 1 deletions
diff --git a/scripts/electronJest.cjs b/scripts/electronJest.cjs
new file mode 100644
index 0000000..a7b7986
--- /dev/null
+++ b/scripts/electronJest.cjs
@@ -0,0 +1,12 @@
1const { app } = require('electron');
2
3if (process.env.DISABLE_GPU === 'true') {
4 app.disableHardwareAcceleration();
5}
6
7app.on('window-all-closed', () => {
8 // Handle event to avoid exiting the application in watch mode.
9});
10
11// @ts-expect-error -- `jest-cli` has no typescript declaration.
12require('jest-cli/bin/jest');
diff --git a/scripts/watch.js b/scripts/watch.js
index 3c3a8fd..eeee6e4 100644
--- a/scripts/watch.js
+++ b/scripts/watch.js
@@ -26,6 +26,9 @@ const serviceInjectModule = path.join(
26 '../packages/service-inject/dist/index.js', 26 '../packages/service-inject/dist/index.js',
27); 27);
28 28
29/** @type {string} */
30const userDataDir = path.join(thisDir, '../userDataDir/development');
31
29/** @type {RegExp[]} */ 32/** @type {RegExp[]} */
30const stderrIgnorePatterns = [ 33const stderrIgnorePatterns = [
31 // warning about devtools extension 34 // warning about devtools extension
@@ -141,7 +144,7 @@ function setupMainPackageWatcher(viteDevServer) {
141 function spawnProcess() { 144 function spawnProcess() {
142 childProcess = spawn( 145 childProcess = spawn(
143 String(electronPath), 146 String(electronPath),
144 ['.', ...process.argv.slice(2)], 147 ['.', `--user-data-dir=${userDataDir}`, ...process.argv.slice(2)],
145 { 148 {
146 stdio: ['inherit', 'inherit', 'pipe'], 149 stdio: ['inherit', 'inherit', 'pipe'],
147 }, 150 },