[test-runner-mocha] implement snapshot testing
See original GitHub issuechai-dom-diff offers snapshot testing via
expect(element).shadowDom.to.equalSnapshot()
This fails in web test runner. Proximal cause is that window.__mocha_context__
is undefined. (this is probably a karma API?)
@LarsDenBakker recommended implementing snapshots directly with mocha, without reference to karma’s globals.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Snapshot Testing - Jest
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.
Read more >Image Snapshot Testing with Mocha - Sebastian Landwehr
This testing approach is great for complex data like large strings, DOM content, or images. I wrote a package to use image snapshot...
Read more >Use expectMetricsJsonToMatchSnapshot in stryker-parent With ...
How to use expectMetricsJsonToMatchSnapshot method in stryker-parent · Run stryker-parent automation tests on LambdaTest cloud grid · Accelerate Your Automation ...
Read more >Creating snapshots in Jest for testing React applications
To write your first snapshot test, you will use the renderer module. This module renders the Document Object Model (DOM) element that will ......
Read more >stryker-mutator/stryker - Gitter
Has anyone here recently tried to use Stryker with Quasar (quasar.dev), Vue, and Jest? I have perfectly functional tests with Jest on my...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@open-wc/semantic-dom-diff
now also supports snapshot testing with WTR. Currently open-wc is in “prerelease” mode until the next version of lit is finalized. For now you can get the latest using thenext
tag for the testing package:Note that snapshot testing is now async, so you need to await the assertion:
Hi everyone,
Do you have any update on when the snapshot would be available with web test runner? I am having some issues with karma and @open-wc/testing (I have some commonJS packages and the preprocessors I tried to convert to esm does not seem to work with @open-wc/testing-karma).
My best bet was web test runner as it makes it very easy to convert CommonJS module with rollup but unfortunately my snapshot tests are not working.
Thank you 😃