From 77125fd96512cdc54e86990a069138428acc27ab Mon Sep 17 00:00:00 2001 From: Matan Borenkraout Date: Sat, 26 Mar 2022 18:47:17 +0300 Subject: [PATCH] feat: enhance `byText` missing error (#1117) --- src/__tests__/element-queries.js | 9 +++++++++ src/queries/text.ts | 24 +++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js index bac8ac4c..05724c15 100644 --- a/src/__tests__/element-queries.js +++ b/src/__tests__/element-queries.js @@ -57,6 +57,15 @@ test('get throws a useful error message', () => {
`) + expect(() => getByText('Lucy Ricardo')) + .toThrowErrorMatchingInlineSnapshot(` + Unable to find an element with the text: Lucy Ricardo (normalized from 'Lucy Ricardo'). This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible. + + Ignored nodes: comments,