-
Notifications
You must be signed in to change notification settings - Fork 64
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
Snapshot test with coverage flag #19
Comments
Hi @KyKyPy3! Thanks for raising the issue, I will have a look as soon as I can. Can you tell me which version of |
I try to use 1.1.3 and version build from master branch. |
@KyKyPy3 any news? Are you trying the latest version? |
Yes, the situation has not changed |
Looks like the issue is related to this one |
I'm running into the same problem, see here: enzymejs/enzyme#640 (comment). I'm using enzyme-to-json 1.3.0, enzyme 2.5.1 and jest 16.0.2 |
Is this in any way related to jamiebuilds/pretty-format@9214857 ? |
@ryanewing I updated to pretty-format@4.2.2 and it didn't fix the issue for me. |
Is it possible for someone to create a small repo which replicates this issue? |
I've tried, but I'm not able to replicate the issue currently. If I run into it again I'll create an example repo. |
Ok, I was able to replicate it. The snapshots were created with
Results are the same locally and remotely.
|
i have the same issue on my current project. I identified it, as being a miss recognition on component written with lambda (example bellow) that has been instrumented by Istanbul.
It can be solved by writing using the following syntaxe.
But i would prefer if we could fix it. Is there someone working on it? should i give it a try (may be this week end)? |
Thanks for your reports! I'll have a look when I have time |
For what its worth it appears to effect https://github.com/rogeliog/jest-serializer-enzyme as well, so I guess the fix should be somewhere upstream but I don't know where. Would be great to have a fix :| |
Maybe this is related? gotwarlost/istanbul#699 |
Hi! I'm very late on this issue! I tried running @ismay's example repo, but as far as I can see, it's not related to console.log(wrapper.debug()); in the test and it shows the same component name as the Snapshot:
The thing is that I'm just using Enzyme wrappers here to generate snapshots but I can't do more than Enzyme, if the output of |
Yeah it's actually a problem with istanbul: #19 (comment) |
Until there is a fix on this issue from istanbul... I found this problem occurs with stateless functional components. You can get the same results with or without coverage in your snapshot tests by setting the .displayName property on stateless functional components. const MyComponent = () => <div></div>
MyComponent.displayName = "MyComponent" |
Exactly! I've recently encountered this issue and I tried to fix it on the istanbul side. I forked istanbuljs/babel-plugin-istanbul#125 Could you folks let me know what you think about my proposal? |
When tested using Jest snapshots i observe different behaviour when I run the tests with --coverage flag or without.
With coverage flag i get
Component
in first childWithout coverage flag i get true React component
ModalHeader
jest configuration:
jest version = 16.0.0
test framework = jasmine2
config = {
"collectCoverageFrom": [
"app/*/.{js,jsx}",
"!app/app.js",
"!app/routes.js"
],
"moduleDirectories": [
"node_modules",
"/Users/romario/Projects/work/imtm/app"
],
"moduleNameMapper": [
[
"..css$",
"/Users/romario/Projects/work/imtm/mocks/cssModule.js"
],
[
"..jpg|..png$",
"/Users/romario/Projects/work/imtm/mocks/image.js"
]
],
"setupTestFrameworkScriptFile": "/Users/romario/Projects/work/imtm/internals/testing/test-bundler.js",
"testRegex": "tests/..test.js$",
"rootDir": "/Users/romario/Projects/work/imtm",
"name": "-Users-romario-Projects-work-imtm",
"setupFiles": [
"/Users/romario/Projects/work/imtm/node_modules/babel-polyfill/lib/index.js"
],
"testRunner": "/Users/romario/Projects/work/imtm/node_modules/jest-jasmine2/build/index.js",
"scriptPreprocessor": "/Users/romario/Projects/work/imtm/node_modules/babel-jest/build/index.js",
"usesBabelJest": true,
"automock": false,
"bail": false,
"browser": false,
"cacheDirectory": "/var/folders/zb/cdw729m57bg8thqz6f863w3c0000gn/T/jest",
"clearMocks": false,
"coveragePathIgnorePatterns": [
"/node_modules/"
],
"coverageReporters": [
"json",
"text",
"lcov",
"clover"
],
"globals": {},
"haste": {
"providesModuleNodeModules": []
},
"mocksPattern": "mocks",
"moduleFileExtensions": [
"js",
"json",
"jsx",
"node"
],
"modulePathIgnorePatterns": [],
"noStackTrace": false,
"notify": false,
"preset": null,
"preprocessorIgnorePatterns": [
"/node_modules/"
],
"resetModules": false,
"testEnvironment": "jest-environment-jsdom",
"testPathDirs": [
"/Users/romario/Projects/work/imtm"
],
"testPathIgnorePatterns": [
"/node_modules/"
],
"testURL": "about:blank",
"timers": "real",
"useStderr": false,
"verbose": null,
"watch": false,
"cache": true,
"watchman": true,
"testcheckOptions": {
"times": 100,
"maxSize": 200
}
}
The text was updated successfully, but these errors were encountered: