From 1ead9c8e3c8cbe91f839b2763f4644fb26e793b4 Mon Sep 17 00:00:00 2001 From: regexowl Date: Fri, 19 Jul 2024 11:27:28 +0200 Subject: [PATCH] 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. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 829cadb9..beaad604 100644 --- a/README.md +++ b/README.md @@ -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`.