react-focus-on: "Sidecar medium was not found" when running unit tests with jest

Hello! I recently added this library to add accessibility features to a modal dialog component (and it works like a charm, thanks!) but I’m having some issues with the tests that use that component. The tests are now failing with the error Sidecar medium was not found.

Using react-testing-library and jest. The test also gives some warnings about updates to sidecar not being wrapped inside an act function, which they are so that seems strange too

Warning: An update to Sidecar inside a test was not wrapped in act(...).
      
When testing, code that causes React state updates should be wrapped into act(...):
      
      act(() => {
        /* fire events that update state */
      });
      /* assert on the output */

Unfortunately the error messages aren’t very helpful so I would appreciate some advice

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

https://github.com/atlassian/yarn-deduplicate might help with resolving such “version overlap” issues, as well as I am working on porting https://github.com/atlassian-labs/webpack-deduplication-plugin to nodejs/jest env to automate aliasing of such sort.

Aha, yes. I got this error as well because we were doing dependency replacement. One repo was on v3.5.0 and one repo was on v3.3.0. Once I aliased everything to use the same instance, it worked like a charm 😃