Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarification for Testing Environment Variables #38359

Merged
merged 3 commits into from
Jul 6, 2022
Merged

Clarification for Testing Environment Variables #38359

merged 3 commits into from
Jul 6, 2022

Conversation

ryanhaticus
Copy link
Contributor

Documentation / Examples

  • Make sure the linting passes by running pnpm lint
  • The examples guidelines are followed from our contributing doc

The Issue

When it came to testing environment variables with jest in the current release of NextJS, I ran into an issue where my variables were seemingly undefined for no reason. With some research and the help from a friend in discussion post #38353 it was determined further configuration steps were needed in relation to the environment variables for jest. At the time being, no direct link is made between Setting up Jest and Test Environment Variables.

The Change

This fix provides further clarification on the issue by creating a new link within the note on the Setting up Jest page. Moreover, further explanations were added to ensure developers understand the test environment is completely separate from both development and production meaning files like .env.development and env.prodution won't be recognized when testing.

Supporting Documentation

This is an issue time and time again for developers. Not only have I experienced this, but others have asked on both GitHub Discussions and StackOverflow. Moreover, many of the solutions from 2020 no longer work properly.

I hope this is sufficient enough for a contribution to the documentation. Minor improvements like these create the ideal developer experience Next.js is known for. :)

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
marsam Mario Rodas

Verified

This commit was signed with the committer’s verified signature. The key has expired.
marsam Mario Rodas

Verified

This commit was signed with the committer’s verified signature. The key has expired.
marsam Mario Rodas
Copy link
Contributor Author

@ryanhaticus ryanhaticus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good. The concise wording is better!

Green light from me!

@kodiakhq kodiakhq bot merged commit 20c1079 into vercel:canary Jul 6, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants