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

Jest throws TypeError ending in lodash-node/lang/isNative #101

Open
BinaryMuse opened this issue Feb 3, 2015 · 1 comment
Open

Jest throws TypeError ending in lodash-node/lang/isNative #101

BinaryMuse opened this issue Feb 3, 2015 · 1 comment

Comments

@BinaryMuse
Copy link
Owner

See the comments at 8eea48c

@svnlto
we have a simple component test using jestand that break using 1.5.2:

TypeError: 
/home/jenkins/workspace/redacted/src/app/components/contacts/__tests__/header-test.js: 
/home/jenkins/workspace/redacted/src/app/components/contacts/header.js: 
/home/jenkins/workspace/redacted/src/app/components/starred/index.js: 
/home/jenkins/workspace/redacted/node_modules/fluxxor/index.js: 
/home/jenkins/workspace/redacted/node_modules/fluxxor/lib/dispatcher.js: 
/home/jenkins/workspace/redacted/node_modules/fluxxor/node_modules/lodash-node/modern/lang/clone.js: 
/home/jenkins/workspace/redacted/node_modules/fluxxor/node_modules/lodash-node/modern/internal/baseClone.js:
/home/jenkins/workspace/redacted/node_modules/fluxxor/node_modules/lodash-node/modern/internal/baseForOwn.js:
/home/jenkins/workspace/redacted/node_modules/fluxxor/node_modules/lodash-node/modern/object/keys.js:
/home/jenkins/workspace/redacted/node_modules/fluxxor/node_modules/lodash-node/modern/lang/isNative.js: Cannot call method 'replace' of undefined

followed by

@xMartin
Hey, it seems to happen if a dependency of a component requires Fluxxor.

Check this demo project: https://github.com/xMartin/fluxxor-issue

and

@BinaryMuse
Wow, that's really quite unfortunate. Thanks for the repro case, it helped a ton.

It looks like it's choking on object/keys down in lang/isNative, which is used by a bunch of the other functions (not just object/clone). I'm not sure why. Adding <rootDir>/node_modules/fluxxor to unmockedModulePathPatterns fixes the issue in the demo project, as does adding jest.dontMock("fluxxor") to the test. Not sure if that will affect your other tests or not, but might be a starting point.

I'm not really familiar with the Jest internals and don't really understand why this is an issue, but I'll continue to look into it. Let me know if the workaround above works for you, and I'll continue to look into a more permanent fix.

@techapman
Copy link

I had to add "fluxxor" and "lodash-node" to my unmockedModulePathPatterns to get past this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants