-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add Snapshot testing #194
Add Snapshot testing #194
Conversation
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 looks great @DawoodShahat! I have some concerns about modifying the svelte files, but other than that this is looking very close.
Checking the CI logs, I noticed this warning:
console.warn
<FilterInput> was created without expected prop 'filterText'
at new FilterInput (src/components/FilterInput.svelte:132:12)
at create_fragment (stories/FilterableList.svelte:56:16)
at init (node_modules/svelte/internal/index.js:1465:37)
at new FilterableList (stories/FilterableList.svelte:193:3)
at getRenderedTree (node_modules/@storybook/addon-storyshots/dist/frameworks/svelte/renderTree.js:20:5)
at node_modules/@storybook/addon-storyshots/dist/test-bodies.js:11:22
at Object.<anonymous> (node_modules/@storybook/addon-storyshots/dist/api/snapshotsTestsTemplate.js:42:20)
It looks like maybe the story is lacking something? It would be good if we could make issues like that fail the CI, as they often indicate bugs.
src/components/FilterInput.svelte
Outdated
@@ -1,5 +1,5 @@ | |||
<script> | |||
import throttle from "just-throttle"; | |||
const throttle = require("just-throttle"); |
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.
With lodash we can just do:
const throttle = require("just-throttle"); | |
import { throttle } from "lodash"; |
... and it'll work
src/components/Markdown.svelte
Outdated
@@ -1,5 +1,5 @@ | |||
<script> | |||
import marked from "marked"; | |||
const marked = require("marked"); |
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.
const marked = require("marked"); | |
import { parseInline } from "marked"; |
Here is what I updated upon @wlach review:
The CI will now fail when there is an unintended change in the markup. I think we should update the README and add some instructions on how to update the generated snapshots with your intended changes e.g. Also one more thing, What do you think about deploying Stories to netlify? By the way thanks for the review, I spent a good amount of time on the error. |
Great idea, could you add something about this to the README? I think we can add them to the storybook: https://github.com/mozilla/glean-dictionary#storybook
This is also a great idea! I think we could probably publish a static copy to |
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.
Code looks great, I think we just need an update to the README and we'll be good to land.
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.
Great stuff, just have some minor suggested changes to the README which I'll apply before landing.
This PR fixes #117
Pull Request checklist
fixes, if applicable)