Next.js Discord

Discord Forum

Jest config question

Unanswered
Crested Myna posted this in #help-forum
Open in Discord
Crested MynaOP
There are a couple details in the docs that lack clarity.

Under the hood, next/jest is automatically configuring Jest for you, including:

Setting up transform using the Next.js Compiler

1. If I'm using Babel, can I still use this next/jest package?

const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})

2. If I am putting app in ./src, then would I put ./ here to indicate the location of the src dir, or would I put ./src? Note, I will be testing things outside of the app directory as well.

3. I am using some webpack configs to get a certain library to run properly. Is there a way to load this in the Jest config (I realize this has nothing to do with nextjs specifically, but still asking).

0 Replies