react-three-fiber: test renderer state is not correct since 8.11.2

I’m experiencing several issues with the test renderer since version 8.11.2. The state of the renderer does not seem to be up-to-date or correct in every case, causing several of my tests to break. I created a repro of one of the issues here: https://codesandbox.io/p/sandbox/react-three-test-renderer-issue-ynh75q

In this example I test the rotation of the cube by taking a snapshot

expect(cubes[0].instance.rotation.toArray()).toMatchInlineSnapshot(`
      [
        1.5707963267948966,
        0.7853981633974483,
        0,
        "XYZ",
      ]
    `);

However, when the rotation prop is set to a Three Euler object (not the tuple), the instance actually has a quite strange Euler inside an Euler as rotation.

Euler {
  isEuler: true,
  _x: Euler {
    isEuler: true,
    _x: 1.5707963267948966,
    _y: 0.7853981633974483,
    _z: 0,
    _order: 'XYZ'
  },
  _y: undefined,
  _z: undefined,
  _order: 'XYZ',
  _onChangeCallback: [Function: onRotationChange]
}

This is likely related to #2757, as that change included in 8.11.2 does actually refer to breaking something in the test renderer. When using r3f 8.11.1 or earlier the output is correct.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Well, that was convenient. I included the patch in v8.14.5. I’ll follow the issue upstream.

Note that this is for @react-three/fiber and not @react-three/test-renderer.