Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't find a root directory while resolving a config file path on Jest tests.

lukaswilkeer June 3, 2019

On test pipeline using default bitbucket-pipelines.yml i'm getting the following error:

 

Error: Can't find a root directory while resolving a config file path.
Provided path to resolve: test/config.json


What could I do?

2 answers

1 accepted

1 vote
Answer accepted
lukaswilkeer June 3, 2019

Solved. It was a mistake.

Marcella Del Tito
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 22, 2019

What was the mistake? I'm likely making the same one :)

Declan Shanaghy July 26, 2021

Ya, post the solution. I'm hitting this error. I added a file to the list of setupFilesAfterEnv and now running into this

The file exists. I can't see any obvious link between adding a file to this config entry and suddenly not being able to determine the root dir

lukaswilkeer July 26, 2021

This project is from years ago. Seeing the only project that runs jest I needed to set --config flag on the npm test task. In that case, this points to test/config.json.

Running it I don't see any problem.

@Declan Shanaghymaybe seting the --config option solved the issue. If you have any problems after this, try open an issue.

Declan Shanaghy July 26, 2021

Thx. I do have the `--config` option set. Must be something else :-(

2 votes
Mark Potter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 3, 2021

The silly mistake I was making was feeding in `--config jest.config.json` when my config file was actually js. Worth checking if google brought you here ;)

Garrett Brustkern
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 9, 2022

Thank you 😅

Mitchell
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 14, 2023

This did the trick! My `package.json` file was looking for a js but I am using Typescript so it was TS.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events