diff options
author | 2022-05-03 19:47:39 +0200 | |
---|---|---|
committer | 2022-05-16 00:55:02 +0200 | |
commit | d2aa484b600dc0d122bb994b9bb29504ffe4cf12 (patch) | |
tree | 1d3e38fdb22f7afe02f1ebcf4b07734761970985 /config/electronJestSetup.cjs | |
parent | refactor: config file saving and debugging (diff) | |
download | sophie-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 'config/electronJestSetup.cjs')
-rw-r--r-- | config/electronJestSetup.cjs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/config/electronJestSetup.cjs b/config/electronJestSetup.cjs new file mode 100644 index 0000000..c53a3f8 --- /dev/null +++ b/config/electronJestSetup.cjs | |||
@@ -0,0 +1,13 @@ | |||
1 | const electron = /** @type {{ ELECTRON_MODULE: import('electron')}} */ ( | ||
2 | /** @type {unknown} */ (globalThis) | ||
3 | ).ELECTRON_MODULE; | ||
4 | |||
5 | const { BrowserWindow } = electron; | ||
6 | |||
7 | jest.mock('electron', () => electron); | ||
8 | |||
9 | afterEach(() => { | ||
10 | BrowserWindow.getAllWindows().forEach((window) => { | ||
11 | window.destroy(); | ||
12 | }); | ||
13 | }); | ||