Closed squillen closed 2 years ago
There is nothing I can do - you need to use jsdom environment in order to use testing-library See https://github.com/testing-library/react-testing-library/issues/422
If you use test runner other than jest - please consult with their documentation for the preferred way of enabling jsdom. There is nothing to be fixed in this library.
Thanks @theKashey, based on your comment I was able to update my .jsdom.js file to look like
import {JSDOM } from 'jsdom';
const dom = new JSDOM('<!DOCTYPE html><html><head></head><body></body></html>');
global.window = dom.window;
global.document = dom.window.document;
global.navigator = { userAgent: 'node.js' };
global.Node = global.Node || {};
which fixes the problem.
My React Testing Library tests are failing with
Uncaught ReferenceError: Node is not defined
. This error is thrown from filefocus-lock/dist/es5/utils/is.js
in versionfocus-lock@0.11.2
, which compiles to:When I declare Node within that file (i.e.
let Node = {}
) my tests pass.