Skip to content

Commit

Permalink
[enzyme-adapter-react-16] [fix] add an explicit .json extension
Browse files Browse the repository at this point in the history
Some folks with broken jest configurations were seeing "'react-test-renderer/package' not found".

Fixes #2046
  • Loading branch information
zombieJ authored and ljharb committed Mar 13, 2019
1 parent 534839f commit 9b964a8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ReactDOM from 'react-dom';
import ReactDOMServer from 'react-dom/server';
// eslint-disable-next-line import/no-unresolved
import ShallowRenderer from 'react-test-renderer/shallow';
import { version as testRendererVersion } from 'react-test-renderer/package';
import { version as testRendererVersion } from 'react-test-renderer/package.json';
// eslint-disable-next-line import/no-unresolved
import TestUtils from 'react-dom/test-utils';
import semver from 'semver';
Expand Down

5 comments on commit 9b964a8

@ramchoudhary
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ljharb ,
Since yesterday, I'm getting "Cannot find module 'react-test-renderer/package' from 'ReactSixteenAdapter.js'" error in my bamboo build. It's working fine in local and it was working fine previously in bamboo as well. Do you think this change might have something to do with this?
Can you please have a look.
I'm using -
"react": "^16.6.3",
"react-dom": "^16.6.3",
"enzyme-adapter-react-16": "^1.7.1",
"react-test-renderer": "^16.2.0",

@ljharb
Copy link
Member

@ljharb ljharb commented on 9b964a8 Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramchoudhary this is fixed in v1.11.1, but it only broke for people using jest, with an invalid moduleFileExtensions (that omits json). Please file an issue if that's not the case for you.

@ramchoudhary
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb I'm using jest only with enzyme.

@ljharb
Copy link
Member

@ljharb ljharb commented on 9b964a8 Mar 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then check your jest config; either way, i should be fixed in v1.11.1.

@ramchoudhary
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah mate! Just upgraded to v1.11.1 from v1.7.1 and now it working fine.
Thanks a lot.

Please sign in to comment.