react-three-fiber icon indicating copy to clipboard operation
react-three-fiber copied to clipboard

chore(tests): add GLTFLoader integration test

Open rkeshwani opened this issue 8 months ago • 2 comments

This PR is made in attempt to remove the following blocker. #3085 There is an existing PR #3086 and this is to solve the blocker on that pr.

This commit adds an integration test for useLoader with GLTFLoader.

The test verifies that the loader can correctly parse a binary GLB file. To achieve this in a Node.js test environment, the following changes were made:

  • node-fetch is added as a dev dependency to provide fetch, Request, and Response objects.
  • These are polyfilled globally in the Jest setup file for all tests to use.
  • The test mocks the fetch call to return a minimal, valid GLB file as an ArrayBuffer.

This approach was chosen after discovering that the native test environment does not support the features required for a full native integration test.

rkeshwani avatar Aug 08 '25 19:08 rkeshwani

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d6f25b6f9017798712c04a8f838cd66a85103a15:

Sandbox Source
example Configuration

codesandbox-ci[bot] avatar Aug 08 '25 19:08 codesandbox-ci[bot]

Thanks for this. It helps. My time has been sparse lately, but I am looking into this issue.

CodyJasonBennett avatar Nov 29 '25 09:11 CodyJasonBennett