Next.js Discord

Discord Forum

How to configure baseUrl in jest?

Unanswered
Golden northern bumble bee posted this in #help-forum
Open in Discord
Golden northern bumble beeOP
The docs only [cover a case](https://nextjs.org/docs/app/building-your-application/testing/jest#optional-handling-absolute-imports-and-module-path-aliases) with Module Path Aliases, but we don't use them. We use just tsconfigs's "baseUrl": "src" + webpack's config.resolve.preferRelative = true which gives us imports like:

import thing from 'components/thing'

where components is a directory in src/

So how to configure the same for jest? Currently, it doesn't see anything in our projects.

0 Replies