-
Notifications
You must be signed in to change notification settings - Fork 46
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
WIP: Add custom jest reporter. Refs #10 #59
Conversation
@badsyntax : should the report call happen in separate call. something like:
|
@NimaSoroush You don't need to explicitly call it like that, you just enable the reporter via the jest The reporter will then check every test for the existence of the snapshot image and the diff image and add those tests to the report. It's probably best to have a custom |
@badsyntax : Cool, that makes sense. I was more thinking of programmatically activation/deactivation of the report. But this looks good as the first version |
@NimaSoroush With this new approach we can support multiple test files. If we have to programmatically activate the report then I don't think we can support a report that indexes multiple tests. |
@badsyntax : even with the thing I suggested to write the report somewhere (e.g. in .txt/json file or keep it in memory like differencify.report) while executing the test, and then when executing
what do you think? |
So I actually prefer for it to be explicit like that, and this is similar to my original approach, but I found it doesn't work well with multiple test files. I changed the approach to use a custom jest reporter to support generating a report that indexes all tests. Let's consider the following scenario:
The problem with this approach is that:
With the new approach, using a custom jest reporter, it works like so:
In this case, we know which exact tests were executed, so we don't need to a directory scan, and the report is only generated once. |
@NimaSoroush Hit me up on Gitter or slack if you'd like to chat in more detail about this |
@badsyntax : Hey Richard, have you got any update on this PR? I am happy to help if anything left |
d80b950
to
49e02ba
Compare
49e02ba
to
2595062
Compare
@@ -50,6 +50,7 @@ | |||
"check-types": "^7.2.0", | |||
"fs": "0.0.1-security", | |||
"jimp": "^0.2.28", | |||
"pkg-dir": "2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
differencify version update not needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. Richard probably going to update this at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely what you mean @nimishseraphim, but this branch is now up to date with master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
He means Differencify@1.3.0 -> Differencify@1.4.0
Can you add this @badsyntax ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this 👍
@NimaSoroush I'll update and finish of these changes this afternoon. Very sorry for the delay. |
@badsyntax : No worries Richard. Take your time and thanks for doing this. I can also help out if you want |
5f19f05
to
e613aa2
Compare
@NimaSoroush Hi Nima. This MR is ready for review again. |
e613aa2
to
1570f64
Compare
src/integration.tests/jest.config.js
Outdated
reporters: [ | ||
'default', | ||
[ | ||
'../dist/reporter', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine to be ../dist/reporter
but it will break the circleCi pipeline as we don't do npm run build
before npm run test:integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update that?
@badsyntax : Hi Richard, Sorry to get back on this with a long delay. I just got some time to check this and put some comments. I ran this locally and noticed that it only generates reports for failed tests? I'll add my generated files here. 2 tests passed and the rest failed, but in the report, I only see failed ones |
|
||
You can generate an index document of the saved images by using the differencify jest reporter. | ||
|
||
Enable the reporter in your jest config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a link to differencify reporter example here?
* FIx issue with testName
* Add dockerignore file to reduce build context size * Add script to run integration tests with volume map * Simplify npm scripts with docker one-liner * Maintian an NPM script for running integration tests locally
…back (NimaSoroush#83) * [NimaSoroush#82] Add support for accessing detailed test values via toMatchSnapshot Updates `toMatchSnapshot` to accept a second argument, a callback. Upon evaluation of the test, the test result is set on the class instance. If `toMatchSnapshot` is given a callback, the callback is invoked upon completion of the test and passed the full result data. - Include additional test result data in return for verbosity - Store result on instance and invoke callback with data if present - Add verbosity to error and success return values * [NimaSoroush#82] Update tests and documentation to reflect toMatchSnapshot changes * [NimaSoroush#82] Add description of arguments for toMatchSnapshot
Fixes spelling error
Fixing issue with freeze image
* Adding awesome badge * update
* chore(package): update dependencies * docs(readme): add Greenkeeper badge
…nto custom-reporter
This PR can be closed in favor of #103 |
Original PR: #32
This change introduces a custom jest reporter that generates a report of the differencify tests once all tests have completed.
Requirements:
To be fixed:
Issues:
package.json
is not supported by CRAjest.config.js
via cli options but that overrides CRA's jest config.