How to set rootDir as process.cwd() + '/..'

Viewed 428

My application was setup as a mono repo. This is the structure:

\mono-repo
|--core
|--app1
|--app2

I run jest at app2. But I also want to run all tests from core. So here is my config

{
    rootDir: process.pwd() + '/..',
    roots: [ 'core', 'app2' ],
}

But it didn't work. Could you give me any idea for this case?

1 Answers

Using process.cwd() works for me. It looks like you're using a JSON file rather than a JS file, so it's not interpreting the command. You can also add --showConfig to the jest command for further debugging.

Related