Skip to content

Commit fe87279

Browse files
committed
fix test failures
1 parent 354e1bc commit fe87279

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.github/workflows/e2e-qss-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
6565
- name: Build App Image
6666
working-directory: ./packages/desktop
67-
run: npm run distUbuntuQss && VERSION=$(jq -r ".version" package.json) && cd dist && FILE_NAME=$(ls | grep $VERSION) && echo "FILE_NAME=$(ls | grep $VERSION)" >> $GITHUB_ENV && cp $FILE_NAME ../../e2e-tests/Quiet && export FILE_NAME=$FILE_NAME
67+
run: npm run distUbuntu:qss && VERSION=$(jq -r ".version" package.json) && cd dist && FILE_NAME=$(ls | grep $VERSION) && echo "FILE_NAME=$(ls | grep $VERSION)" >> $GITHUB_ENV && cp $FILE_NAME ../../e2e-tests/Quiet && export FILE_NAME=$FILE_NAME
6868

6969
- name: Chmod
7070
working-directory: ./packages/e2e-tests/Quiet

packages/desktop/src/main/loadMainEnvs.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ import path from 'path'
22
import { app } from 'electron'
33
import { DESKTOP_DATA_DIR, DESKTOP_DEV_DATA_DIR } from '@quiet/common'
44
import { __nodeConsoleLogger } from '@quiet/logger'
5-
import dotenvx from '@dotenvx/dotenvx'
5+
// Defer loading to runtime to avoid Jest resolver issues with ESM subpath exports
6+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7+
let dotenvx: any
8+
try {
9+
// eslint-disable-next-line @typescript-eslint/no-var-requires
10+
dotenvx = require('@dotenvx/dotenvx')
11+
} catch (e) {
12+
// If not available/resolveable in test, leave undefined; guarded use below
13+
}
614
__nodeConsoleLogger.info('Environment variables', JSON.stringify(process.env, null, 2))
715

816
const isDev = process.env.NODE_ENV === 'development'
@@ -13,12 +21,12 @@ if (isDev || process.env.DATA_DIR) {
1321

1422
try {
1523
const pathProd = path.join.apply(null, [process.resourcesPath, '.env'])
16-
const loadedEnvVarsresult = dotenvx.config({ path: pathProd })
17-
__nodeConsoleLogger.info('Loaded env vars', JSON.stringify(loadedEnvVarsresult.parsed, null, 2))
18-
if (loadedEnvVarsresult.error) {
19-
__nodeConsoleLogger.error(`Error occurred while loading main envs`, loadedEnvVarsresult.error)
20-
} else {
21-
// save env file contents to a variable for passthrough
24+
if (dotenvx?.config) {
25+
const loadedEnvVarsresult = dotenvx.config({ path: pathProd })
26+
__nodeConsoleLogger.info('Loaded env vars', JSON.stringify(loadedEnvVarsresult.parsed, null, 2))
27+
if (loadedEnvVarsresult.error) {
28+
__nodeConsoleLogger.error(`Error occurred while loading main envs`, loadedEnvVarsresult.error)
29+
}
2230
}
2331
} catch (e) {
2432
__nodeConsoleLogger.error(`Error occurred while loading main envs`, e)

packages/desktop/src/rtl-tests/community.create.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('User', () => {
4949
unobserve: jest.fn(),
5050
disconnect: jest.fn(),
5151
}))
52+
process.env.QSS_ALLOWED = 'false'
5253
})
5354

5455
afterEach(() => {

0 commit comments

Comments
 (0)