Igor Babkin
Igor Babkin

Reputation: 509

How do I specify module directories for Jest?

I can't specify modulesDirectories for Jest like as in Webpack. Is it possible to do that?

Upvotes: 2

Views: 2200

Answers (2)

aciddoll
aciddoll

Reputation: 841

I know this is an old question. Support has now been added to jest so now you can simply add moduleDirectories to your jest config. If you're using package.json that would be

"jest": {
    "moduleDirectories": [
        "node_modules", 
        "yourdirectoryhere"
     ],
 ...
}

Upvotes: 4

Richard Scarrott
Richard Scarrott

Reputation: 7053

Jestpack might work for you as it runs built tests so all Webpack features are supported.

Upvotes: 0

Related Questions