TypeError: Cannot read property 'match' of null

Please provide the following:

  1. SDK Version: 42.0.0
  2. Platforms(Android/iOS/web/all): all
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Hello all, I am trying to integrate testing into my app following this guide: Testing with Jest - Expo Documentation

I have a simple test for the App component shown below:

import React, { ReactNode } from "react";
import renderer from "react-test-renderer";

import App from "./App";

describe("<App />", () => {
	it("renders correctly", () => {
		const tree = renderer.create(<App />).toJSON();

My problem is: I only have a single test file shown above. The test was passing and working fine up to now. All of a sudden when I run yarn test command the following error is thrown and the test fails.

Maybe it is something related to the expo source code. I tried looking into the expo folder inside node_modules but couldn’t find the source code for logging.fx.ts file
I am totally lost on how this occurs or how to resolve this. Any leads on the issue or where I can dig deeper would be greatly appreciated.

I also got this issue. Using ejected Expo 41.0.1 and RN 0.63.4.

I basically have the same case - I just wanted to create some snapshot tests, exactly the same way you did on your screenshots.

Although I highly discourage it long-term, for a temporary solution you can override line 30 in file /node_modules/react-native/Libraries/Core/Devtools/getDevServer.js and add ? after scriptURL as I did below:

If you want to persist those changes in your project, make sure to use a library like patch-package or otherwise the override will work only locally for you.

It shouldn’t break anything and temporarily allows your tests to pass. Hope that helps :v:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.