blakeembrey / change-case

Convert strings between camelCase, PascalCase, Capital Case, snake_case and more
MIT License
2.21k stars 92 forks source link

Upgrading from `change-case@5.0.0` to `change-case@5.0.1` results in a "Cannot find module" error while testing #315

Closed brekk closed 8 months ago

brekk commented 8 months ago

When I am running anything after change-case@5.0.0 I cannot seem to get it to play nicely with jest.

If this was prior to the ESM change, I wouldn't be surprised, but when I have change-case@5.0.0 in my monorepo (yarn workspace robot-tourist run test:all) if you feel like trying to reproduce, it results in a passing test.

When I upgrade to anything newer, it barfs with:

 FAIL  src/string.spec.js
  ● Test suite failed to run

    Cannot find module 'change-case' from 'src/string.js'

    Require stack:
      src/string.js
      src/string.spec.js

      48 | import { evidenceOfImports } from './source-matcher'
      49 | import { trace } from './trace'
    > 50 |
         | ^
      51 | export const matchesCaseFormat = curry((formatter, x) => formatter(x) === x)
      52 |
      53 | export const classify = cond([

      at Resolver._throwModNotFoundError (../../node_modules/jest-resolve/build/resolver.js:428:11)
      at Object.<anonymous> (src/string.js:50:21)
      at Object.<anonymous> (src/string.spec.js:5:17)

It's entirely possible I've made a mistake on my side, but I couldn't see any good reason why there'd be such a noticeable difference relative to what I understand the changes to be.

brekk commented 8 months ago

Apologies, I still don't have a solution on my side but I tried a minimal reproduction and it doesn't seem like I was correct in my initial assessment