Jest Test Error(rest api test using fetch): ReferenceError: XMLHttpRequest is not defined

Env:

  • expo": “^30.0.1”
  • jest-expo": “30.0.0”
  • i create the project using ‘expo-cli’

I want to test the fetch api method
but ‘ReferenceError: XMLHttpRequest is not defined.’ error return

// test file

// test api method

※ I don’t want to make a mock promise, i want to test a real url api fetch function.

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