Skip to content

Commit

Permalink
test: load env variables so npm test works locally (#742)
Browse files Browse the repository at this point in the history
We [set environment variables in CI][0] so that `npm test` works, but it
doesn't work locally because Jest isn't loading them.

This loads them when running Jest.

[0]: https://github.com/digidem/comapeo-mobile/blob/9b6cf8f71a0d960174c7e8cd5ce1b6bb8f1dd5a7/.github/workflows/ci.yml#L72-L75

Co-Authored-By: Gregor MacLennan <[email protected]>
  • Loading branch information
EvanHahn and gmaclennan authored Oct 8, 2024
1 parent c44b91b commit d3314f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"ios-no-backend-rebuild": "expo run:ios",
"prestart": "npm run build:translations && npm run build:intl-polyfills",
"start": "expo start",
"test": "jest",
"test": "dotenv jest",
"lint:prettier": "prettier \"src/**/*.{js,ts,jsx,tsx}\" --check",
"lint:eslint": "eslint . --ext .js,.jsx,.ts,.tsx --cache --ignore-path .gitignore",
"lint:types": "tsc --noEmit",
Expand Down Expand Up @@ -143,6 +143,7 @@
"babel-jest": "^29.6.3",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"date-fns": "^3.6.0",
"dotenv-cli": "^7.4.2",
"eslint": "^8.19.0",
"eslint-config-prettier": "^9.1.0",
"execa": "^8.0.1",
Expand Down

0 comments on commit d3314f5

Please sign in to comment.