-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imports not working when done through tests #872
Comments
@RobertBroersma Good day sir, do we need to install babel-jest? |
@peterp I think this is a Windows issue, because it WorksOnMyMachine™ I had this issue before when trying some weird Jest stuff with passing configs through the Jest cli, but with this new defining configs in the app repo business the error is gone for me. Back then I fixed it by replacing the I've seen some weird shit with Jest and Babel though. I get this exact issue when trying to use an umbrella Jest config in the Redwood repo itself. None of the answers found by Google-ing have worked unfortunately. EDIT: I think there would be stuff that fails earlier than this import if not having |
Anything I can do to help debug this? |
@Tobbe Does this also happen in your API tests? My above comment and your logs are all the info I have I'm afraid. I think this requires a bit of a deep dive and some trial and error to figure out. If you'd want to pick this up that would be awesome! If not I'll take a look when I get the time, but if all goes well I'll be on vacation starting tomorrow. If you want a quick workaround I guess you could make those imports relative, but... we don't want that...! 😒 |
It happens with the API tests too
And this is import { db } from 'src/lib/db'
export const posts = async () => {
return db.post.findMany()
}
export const post = ({ id }) => {
// ... |
A relative import does indeed work import { db } from '../../lib/db'
export const posts = async () => {
return db.post.findMany()
}
export const post = ({ id }) => {
// ... |
It looks like jest is incorrectly determining the |
@peterp Hmmm I would've expected to not need that when using Babel, but let's give that a try! |
I'm still getting this same error
|
Could you run |
I tried. Didn't help. I still get the same error message |
@Tobbe Could you give me access to your repo? |
Didn't have anything up on Github, so I just now created a new project and pushed that https://github.com/Tobbe/v14 |
I've dug a bit more and I believe that we're hitting this issue: jestjs/jest#8006 I'll be opening a fix soon - but my gut feeling is that --projects are going to give us more trouble than they're worth in the short term. Let's see how it goes? |
Reproduce
Install fresh RW 0.14
yarn rw g page post
yarn rw g layout post
Modify PostPage to include PostLayout, and wrap everything in the layout
Run all tests with
yarn rw test
Expected
All tests pass
Actual
Note
I need #869 first, before I can actually get this far.
Actually running the app with
yarn rw dev
works fine. No problems with the importsThe text was updated successfully, but these errors were encountered: