Comments (2)
Debug should be able to watch for dom changes, so that we can put debug at the beginning of the test, and then have the latest dom represented at time of failure.
Hi @benguenter, it will be the Automatic Mode in the future release, similar to what jest-preview's Automatic Mode.
But in the meantime, you can use this setup to watch the dom changes whenever a test fails, thanks to @BrandonGoren
#21 (comment)
import { debug } from 'vitest-preview';
import { cleanup } from '@testing-library/react';
afterEach(context => {
// Run vitest-preview's debug if the test fails
if (context?.meta?.result?.state === 'fail') {
debug();
}
// Clean up react-testing-library. We need to manually do this because we
// turn off the automatic teardown in the vite.config.
// This needs to happen after vitest-preview.
cleanup();
});
from vitest-preview.
Another way is to call debug
from the getElementError hook in the testing-library.
But if you want, you can open a PR at https://dom-preview.knappi.org/ which I developed as an alternative to vitest-preview
. The setup is a little more complex though.
from vitest-preview.
Related Issues (13)
- Add documentation
- Integrate Nx
- Add Svelte example
- Add `vitest-preview setup` CLI
- Fix stackblitz example HOT 3
- Try now and try online does not work HOT 3
- [Feature request] autoPreview mode HOT 1
- Upgrade to vite 4 HOT 4
- When the 'root' configuration is set to something other than the default, hot reload doesn't work
- Add the ability to run the server from code HOT 1
- Why is Vite a dependency rather than a peer dependency? HOT 1
- Refactor build-setup and bump versions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitest-preview.