From 709044baa1c4ba5e44d104126de7308fc5d9e482 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Fri, 29 May 2020 01:38:55 +0200 Subject: [PATCH] feat: Improve performance of ByRole in waitFor* (#590) Co-authored-by: Kent C. Dodds --- src/__tests__/role.js | 6 ++++++ src/config.js | 10 ++++++++++ src/queries/role.js | 4 ++++ src/wait-for.js | 4 ++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/__tests__/role.js b/src/__tests__/role.js index 58685d76..a187a77b 100644 --- a/src/__tests__/role.js +++ b/src/__tests__/role.js @@ -343,6 +343,12 @@ Here are the accessible roles: `) }) +test('has no useful error message in findBy', async () => { + const {findByRole} = render(`
  • `) + + await expect(findByRole('option', {timeout: 1})).rejects.toThrow('Unable to find role="option"') +}) + test('explicit role is most specific', () => { const {getByRole} = renderIntoDocument( `