ci: provision .env before running tests#62
Merged
Conversation
The `test` job fails at babel-transform time with `SyntaxError: "REWARDS_ENABLED" is not defined in .env` (and BTC_PAY_SERVER). The dotenv-import babel plugin (moduleName '@env', path '.env') validates every `@env` import against .env at transform time; .env is gitignored and CI never created one, so jest's transform throws. Lint/typecheck pass because they don't run that transform. Copy .env.example (which already defines all 6 @env vars used in src/) to .env before the test step. Pre-existing main failure; unblocks all PRs.
islandbitcoin
added a commit
that referenced
this pull request
Jul 8, 2026
App.test.tsx fails to run in CI with "WebSocket implementation missing": it imports App -> src/graphql/ApolloClient.ts, which eagerly calls graphql-ws createClient at module load, requiring a WebSocket impl. CI pins Node 20 (no global WebSocket); Node 22+ provides it, which masks the issue in local dev. `ws` is already a dependency, so alias it onto global.WebSocket in jest.setup.js. Verified under Node 20: full suite 18/18 suites, 142 tests pass. Second half of the CI test fix (follows the .env provisioning in #62). Co-authored-by: Dread <dread@example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
testCI job has been failing onmain(and thus on every open PR, including #61) with:Root cause
babel.config.jsuses thedotenv-importplugin (moduleName: '@env',path: '.env'), which validates every@envimport against.envat transform time..envis gitignored (.gitignore:77) andci.ymlnever created one, so whenyarn testruns jest → babel, the transform throws on the first@envimport (e.g.src/utils/featureFlags.ts).Lint and typecheck pass because they don't run the babel dotenv transform — only jest does, which is why
testwas the sole red check.Fix
Copy
.env.example→.envbefore the test step. Verified.env.examplealready defines all 6@envvars used acrosssrc/(BTC_PAY_SERVER, FLASH_GRAPHQL_URI, FLASH_GRAPHQL_WS_URI, FLASH_LN_ADDRESS, FLASH_LN_ADDRESS_URL, REWARDS_ENABLED), so a single copy fully satisfies the plugin.Independent of any feature work — this unblocks the
testcheck for all open PRs.🤖 Generated with Claude Code