DEV Community

The Project Alpha
The Project Alpha

Posted on • Edited on

2 2

Got an issue while running test with Jest on my typescript next js app

Hi everyone,

I had an issue while I was testing my next js app. My app needs some environment variables to get data. However, I didn't found a way to make my code work...

https://github.com/hugos29dev/the-Project-Alpha/issues/3

Can someone take a look to it...

Hugo

Top comments (2)

Collapse
 
kvsm profile image
Kevin Smith 🏴󠁧󠁢󠁳󠁣󠁴󠁿

You need to load your dotenv in your tests too. Try adding

beforeAll(async () => dotenvLoad())

...before your test.

Collapse
 
theprojectalpha profile image
The Project Alpha

Thanks,

it works with the code you proposed.

Hugo

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series