README: Add DOM dump silencing to Test Guidelines

This adds information about silencing DOM dumps in testing-library test output and how to allow DOM dump again if needed.
This commit is contained in:
regexowl 2024-07-19 11:27:28 +02:00 committed by Klara Simickova
parent 1febbe4620
commit 1ead9c8e3c

View file

@ -260,6 +260,19 @@ npm run test
These tests will also be run in our CI when a PR is opened.
Note that `testing-library` DOM printout is currently disabled for all tests by the following configuration in `src/test/setup.ts`:
```typescript
configure({
getElementError: (message: string) => {
const error = new Error(message);
error.name = 'TestingLibraryElementError';
error.stack = '';
return error;
},
});
```
If you'd like to see the stack printed out you can either temporarily disable the configuration or generate a [Testing Playground](https://testing-playground.com/) link by adding `screen.logTestingPlaygroundURL()` to your test.
### Using MSW data in development
If you want to develop in environment with mocked data, run the command `npm run stage-beta:msw`.