Maintainable tests of actual SVG output#47
Merged
borisyankov merged 15 commits intoborisyankov:masterfrom May 5, 2016
Merged
Conversation
(Run bootstrap-tests.js with e.g. babel-node to generate a new fixtures.js)
Importantly, we normalize property order in the SVG style attribute before comparing, to avoid spurious errors on essentially identical images. A side benefit is nicer error messages on test failures.
…eplace with var name
bootstrap-tests.js relies on the particulars of this module's string formatting behavior, so let's be defensive here.
| const htmlCode = JSON.stringify(wrapper.html()); | ||
|
|
||
| for (let dataKey of Object.keys(recognizedDataStrings)) { | ||
| jsxCode = replaceAll(recognizedDataStrings[dataKey], dataKey, jsxCode); |
Contributor
Author
There was a problem hiding this comment.
@borisyankov This allows us to write data={sampleData} in fixtures.js rather than data={[0.26789611283279424, ...]} every time. Yes, I used string replacement to do this. It's slow and kind of inelegant but it works :) Which to my taste is good enough for this kind of dev script.
This remove the unused dependency on jsdom (enzyme's `mount`), which requires node@>=4.
# Conflicts: # package.json
# Conflicts: # package.json
Owner
|
I see this PR also contains the changes from the other PR fixing Travis... they both did get a merge conflict caused by my last commit. |
# Conflicts: # package.json
Contributor
Author
|
I've now updated all my PRs with your latest work on master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the regression test suite I'm using to work on #46 confidently.
For ease of maintenance, I included a script (
bootstrap-tests.js/npm run test:bootstrap) that can be used to update the reference renderings in-place when they legitimately change.That script is kind of a lot of code and probably not the prettiest, but I hope you'll find it good enough to accept as-is. I'll attach some more notes to the relevant commits in a moment.