From d50a9672af6adc80f1e79e4eeb4e0342f3d1e5de Mon Sep 17 00:00:00 2001 From: Robin Drexler Date: Tue, 9 Aug 2022 10:09:12 -0400 Subject: [PATCH] fix: log ignored selectors correctly on error (#1141) Co-authored-by: Sebastian Silbermann --- src/__tests__/element-queries.js | 59 ++++++++++++++++++++++---------- src/__tests__/role.js | 54 ++++++++++++++--------------- src/__tests__/suggestions.js | 4 +-- src/__tests__/wait-for.js | 44 ++++++++++++------------ src/config.ts | 2 +- 5 files changed, 93 insertions(+), 70 deletions(-) diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js index 0739ea37..83a897f4 100644 --- a/src/__tests__/element-queries.js +++ b/src/__tests__/element-queries.js @@ -1,6 +1,16 @@ -import {configure} from '../config' +import {configure, getConfig} from '../config' import {render, renderIntoDocument} from './helpers/test-utils' +// set original config +let originalConfig +beforeAll(() => { + originalConfig = getConfig() +}) + +afterEach(() => { + configure(originalConfig) +}) + test('query can return null', () => { const { queryByLabelText, @@ -35,7 +45,7 @@ test('get throws a useful error message', () => { .toThrowErrorMatchingInlineSnapshot(` Unable to find a label with the text of: LucyRicardo - Ignored nodes: comments,