9.1.0 • Published 6 months ago

@react-three/test-renderer v9.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

React Three Test Renderer ⚛️🔼🧪

Version Downloads Twitter Twitter Discord

@react-three/test-renderer is a React testing renderer for threejs in node.

yarn add @react-three/fiber three
yarn add -D @react-three/test-renderer

The problem

You've written a complex and amazing webgl experience using @react-three/fiber and you want to test it to make sure it works even after you add even more features.

You go to use react-dom but hang on, THREE elements aren't in the DOM! You decide to use @react-three/test-renderer you can see the container & the canvas but you can't see the tree for the scene!? That's because @react-three/fiber renders to a different react root with it's own reconciler.

The solution

You use @react-three/test-renderer ⚛️-🔼-🧪, an experimental React renderer using @react-three/fiber under the hood to expose the scene graph wrapped in a test instance providing helpful utilities to test with.

Essentially, this package makes it easy to grab a snapshot of the Scene Graph rendered by three without the need for webgl & browser.


Usage

RTTR is testing library agnostic, so we hope that it works with libraries such as jest, jasmine etc.

import ReactThreeTestRenderer from '@react-three/test-renderer'

const renderer = await ReactThreeTestRenderer.create(
  <mesh>
    <boxGeometry args={[2, 2]} />
    <meshStandardMaterial
      args={[
        {
          color: 0x0000ff,
        },
      ]}
    />
  </mesh>,
)

// assertions using the TestInstance & Scene Graph
console.log(renderer.toGraph())

API

8.2.3

9 months ago

8.2.2

10 months ago

8.2.4

9 months ago

9.0.1

9 months ago

9.1.0

6 months ago

9.0.0-rc.10

9 months ago

9.0.0-rc.7

9 months ago

9.0.0-rc.8

9 months ago

9.0.0-rc.5

10 months ago

9.0.0-rc.6

9 months ago

9.0.0-rc.9

9 months ago

9.0.0-rc.0

1 year ago

9.0.0-rc.3

10 months ago

9.0.0-rc.4

10 months ago

9.0.0-rc.1

12 months ago

9.0.0-rc.2

10 months ago

9.0.0-alpha.7

1 year ago

9.0.0-alpha.8

1 year ago

9.0.0-beta.1

1 year ago

9.0.0-beta.0

1 year ago

9.0.0-alpha.6

2 years ago

9.0.0-alpha.5

2 years ago

9.0.0-alpha.4

2 years ago

9.0.0-alpha.3

2 years ago

8.2.1

2 years ago

8.2.0

2 years ago

8.1.5

2 years ago

8.1.4

2 years ago

8.1.3

2 years ago

8.1.2

3 years ago

8.1.0

3 years ago

8.1.1

3 years ago

10.0.2

3 years ago

10.0.3

3 years ago

11.0.0

3 years ago

8.0.17

3 years ago

10.0.0

3 years ago

10.0.1

3 years ago

8.0.16

3 years ago

8.0.15

3 years ago

9.0.0

3 years ago

7.0.27

4 years ago

7.0.26

4 years ago

8.0.12

4 years ago

8.0.11

4 years ago

8.0.14

3 years ago

8.0.13

3 years ago

8.0.9

4 years ago

8.0.8

4 years ago

8.0.5

4 years ago

8.0.4

4 years ago

8.0.7

4 years ago

8.0.6

4 years ago

8.0.10

4 years ago

8.0.1

4 years ago

8.0.0

4 years ago

8.0.3

4 years ago

8.0.2

4 years ago

7.0.24

4 years ago

7.0.25

4 years ago

7.0.25-beta.0

4 years ago

8.0.0-beta.0

4 years ago

7.0.23

4 years ago

7.0.21

4 years ago

7.0.22

4 years ago

7.0.20

4 years ago

7.0.18

4 years ago

7.0.19

4 years ago

7.0.17

4 years ago

7.0.16

4 years ago

7.0.14

4 years ago

7.0.15

4 years ago

7.0.12

4 years ago

7.0.13

4 years ago

7.0.10

4 years ago

7.0.11

4 years ago

7.0.8

4 years ago

7.0.7

4 years ago

7.0.6

4 years ago

7.0.5

4 years ago

7.0.4

4 years ago

7.0.3

4 years ago

7.0.1

4 years ago

6.2.3

4 years ago

6.1.0

5 years ago

6.1.1

5 years ago

6.2.2

4 years ago

6.1.5

4 years ago

6.0.6

5 years ago

6.0.3

5 years ago

6.0.2

5 years ago

6.0.5

5 years ago

6.0.1

5 years ago

6.0.0

5 years ago

6.0.0-beta.2

5 years ago

6.0.0-beta.1

5 years ago

0.0.1

5 years ago