When running my app, everything is running fine as expected. However, if I run a test using jest, the test can't make the connection of the path in my gatsby config file. Below is a hiearchy of what I am running into.
gatsby-config:
...
{
resolve: "gatsby-plugin-root-import",
options: {
reducers: path.join(__dirname, "src/reducers"),
sagas: path.join(__dirname, "src/sagas"),
web: path.join(__dirname, "src/web"),
test: path.join(__dirname, "src/web"), <-------- test cases don't live on the root
},
},
....
Test Error:
ā Test suite failed to run
Cannot find module 'web/components/graphs/line-graph' from 'src/web/components/card/index.js'
Require stack:
src/web/components/card/index.js
src/web/components/card/test/index.test.js
1 | import React from "react"
2 | import { string, array } from "prop-types"
> 3 | import LineGraph from "web/components/graphs/line-graph"
