Skip to content
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

Undocumented breaking change with moduleDirectories config in Jest v20 #3535

Closed
lourd opened this issue May 9, 2017 · 6 comments
Closed
Labels

Comments

@lourd
Copy link

lourd commented May 9, 2017

Hey y'all, congrats on the release of v20! A lot of really great additions, as well as critical, less-flashy work refactoring for the future. Thank you for your efforts 🙏🏼

Just updated a couple projects and ran into an undocumented breaking change. It's not really an issue to fix, but I want to document it for other folks who run into it.

After upgrading from v19 to v20 I had all of my tests failing with various Cannot find module errors. First it was coming from a script loading polyfills so I was seeing Cannot find module 'babel-polyfill' from 'polyfills.js', so I thought it was part of the changes to Jest no longer loading babel-polyfill internally. I commented that file out though and got Cannot find module 'once' from 'queueRunner.js', which was definitely not in my codebase. At that point I started playing around with some config changes to see what might affect it.

Turned out to be the moduleDirectories configuration. I've been using "<rootDir>" in each entry, which doesn't seem to be valid any longer. Once I dropped that prefix that fixed everything.

     "moduleDirectories": [
-      "<rootDir>/app/",
-      "<rootDir>/node_modules/"
+      "app",
+      "node_modules"
     ],
@cpojer
Copy link
Member

cpojer commented May 10, 2017

Thank you! This is actually a regression and we'll fix it in a patch release.

@pcvandamcb
Copy link

pcvandamcb commented May 10, 2017

Not sure if the same regression, but this also does not work anymore in v20:

"testMatch": [
  "<rootDir>/tests/frontend-unit/**/*Test.js"
]

Problem is, without the <rootDir> I also can't get the glob to work anymore.

@cpojer
Copy link
Member

cpojer commented May 10, 2017

We should also fix that one, yes. Thanks for mentioning it.

@ismay
Copy link

ismay commented May 10, 2017

Maybe it's not necessary that I mention this, but this also failed for me after upgrading to v20:

{
  "snapshotSerializers": [
    "<rootDir>/node_modules/jest-serializer-enzyme"
  ]
}

@cpojer
Copy link
Member

cpojer commented May 11, 2017

Fixed in the latest patch.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants