From d5478f8d951a1268bc09ee5e1438e615f280d25d Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Mon, 18 Nov 2019 16:37:06 +0100 Subject: [PATCH] Warn about a11y tree exclusion --- test/utils/init.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/utils/init.js b/test/utils/init.js index 9c244342638fde..e2925cb103309e 100644 --- a/test/utils/init.js +++ b/test/utils/init.js @@ -4,12 +4,15 @@ import * as testingLibrary from '@testing-library/react/pure'; import consoleError from './consoleError'; import './initMatchers'; -consoleError(); - enzyme.configure({ adapter: new Adapter() }); // checking if an element is hidden is quite expensive // this is only done in CI as a fail safe. It can still explicitly be checked // in the test files which helps documenting what is part of the DOM but hidden // from assistive technology -testingLibrary.configure({ defaultHidden: !process.env.CI }); +const defaultHidden = !process.env.CI; +// adds verbosity for something that might be confusing +console.warn(`${defaultHidden ? 'including' : 'excluding'} inaccessible elements by default`); +testingLibrary.configure({ defaultHidden }); + +consoleError();