diff --git a/jest/setup.ts b/jest/setup.ts index 8bb18552d3..c371af3c56 100644 --- a/jest/setup.ts +++ b/jest/setup.ts @@ -1,7 +1,11 @@ +import dotenv from 'dotenv'; + import fetchMock from 'jest-fetch-mock'; fetchMock.enableMocks(); +const envs = dotenv.config({ path: './configs/envs/.env.jest' }); + Object.defineProperty(window, 'matchMedia', { writable: true, value: jest.fn().mockImplementation(query => ({ @@ -16,6 +20,11 @@ Object.defineProperty(window, 'matchMedia', { })), }); +Object.defineProperty(window, '__envs', { + writable: true, + value: envs.parsed || {}, +}); + // eslint-disable-next-line no-console const consoleError = console.error; diff --git a/tools/scripts/pw.sh b/tools/scripts/pw.sh index 9dcfd5fff2..a8fa9dd069 100755 --- a/tools/scripts/pw.sh +++ b/tools/scripts/pw.sh @@ -4,11 +4,11 @@ config_file="./configs/envs/.env.pw" rm -rf ./playwright/.cache -set -a -source "$config_file" -set +a - -export NODE_OPTIONS="--max-old-space-size=4096" - -./deploy/scripts/make_envs_script.sh -playwright test -c playwright-ct.config.ts "$@" \ No newline at end of file +dotenv \ + -e $config_file \ + -- bash -c './deploy/scripts/make_envs_script.sh' + +dotenv \ + -v NODE_OPTIONS=\"--max-old-space-size=4096\" \ + -e $config_file \ + -- playwright test -c playwright-ct.config.ts "$@"