For week 7, I continued with my work on the DNS Record creation page. This basically involved resolving all the review comments, and trying to get tests working. However, I ran into another sign in problem in the Playwright test environment:
I did not want to resolve this specific issue in the same PR as the one creating the page so I decided to create a separate issue for it.
While working on the DNS Record creation page, I rebased my branch with the main branch as it had gotten out of date. After this, I found that I could no longer run the app, and got this error:
'SECRETS_OVERRIDE' is not recognized as an internal or external
command, operable program or batch file.
I saw that the dev
script had been modified to override an ENV variable:
"dev": "SECRETS_OVERRIDE=1 run-p dev:*"
However, this syntax is not supported on Windows. So, I created a PR to use cross_env
so it would also work on windows.
After addressing all the comments on my original PR (to create the new page UI), I helped Genne23v resolve CI failure on this PR. New code had been added that would check for an ENV variable value and crash if the environment was production
and no value was specified. However, this should not have affected the end to end tests as the environment there was set to testing
:
"start:e2e": "cross-env NODE_ENV=testing node --require
dotenv/config ./build/server.js",
This script starts the app when end to end tests are run. However, after some investigation and through this discussion, I found that there were two problems with this approach:
testing
is not a valid value forNODE_ENV
. Providingtesting
will result inNODE_ENV
being set toproduction
During the build process, all calls to
process.env.NODE_ENV
in the code are replaced with the actual value forNODE_ENV
. Thus, something likeconsole.log(process.env.NODE_ENV)
would becomeconsole.log("production")
. This was done by the following script. Here, no value forNODE_ENV
is given, and thereforeproduction
is assumed by default.
"pretest:e2e:run": "cross-env SECRETS_OVERRIDE=1 run-s build"
Moving the override to this script and changing the value to test
resulted in the CI passing again:
"pretest:e2e:run": "cross-env NODE_ENV=test SECRETS_OVERRIDE=1
run-s build"
More information about this process can be found in this discussion.
Top comments (0)