pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.65k stars 1.6k forks source link

chore(RTTR): Prevent warn log in test #3158

Closed satelllte closed 7 months ago

satelllte commented 10 months ago

The change prevents console.warn output log pollution, as well as covers it with test.

Example of log from the latest run in master branch:

PASS packages/test-renderer/src/__tests__/RTTR.events.test.tsx
  ● Console

    console.warn
      Handler for onPointerUp was not found. You must pass event names in camelCase or name of the handler https://github.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr.md#create-fireevent

      28 |     }
      29 |
    > 30 |     console.warn(
         |             ^
      31 |       `Handler for ${eventName} was not found. You must pass event names in camelCase or name of the handler https://github.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr.md#create-fireevent`,
      32 |     )
      33 |

      at findEventHandler (packages/test-renderer/src/fireEvent.ts:30:13)
      at packages/test-renderer/src/fireEvent.ts:50:[21](https://github.com/pmndrs/react-three-fiber/actions/runs/7630812513/job/20787324972#step:8:22)
      at packages/test-renderer/src/fireEvent.ts:1320:39
      at Object.<anonymous>.__awaiter (packages/test-renderer/src/fireEvent.ts:1269:10)
      at invokeEvent (packages/test-renderer/src/fireEvent.ts:49:119)
      at packages/test-renderer/src/fireEvent.ts:69:28
      at packages/test-renderer/src/fireEvent.ts:1320:39
      at Object.<anonymous>.__awaiter (packages/test-renderer/src/fireEvent.ts:1269:10)
      at fireEvent (packages/test-renderer/src/fireEvent.ts:69:21)
      at packages/test-renderer/src/__tests__/RTTR.events.test.tsx:53:30
      at packages/test-renderer/src/__tests__/RTTR.events.test.tsx:31:71
      at Object.<anonymous>.__awaiter (packages/test-renderer/src/__tests__/RTTR.events.test.tsx:27:12)
      at packages/test-renderer/src/__tests__/RTTR.events.test.tsx:53:[23](https://github.com/pmndrs/react-three-fiber/actions/runs/7630812513/job/20787324972#step:8:24)
      at Object.<anonymous> (node_modules/expect/build/toThrowMatchers.js:83:11)
      at Object.throwingMatcher [as toThrow] (node_modules/expect/build/index.js:382:21)
      at packages/test-renderer/src/__tests__/RTTR.events.test.tsx:53:79
      at fulfilled (packages/test-renderer/src/__tests__/RTTR.events.test.tsx:[28](https://github.com/pmndrs/react-three-fiber/actions/runs/7630812513/job/20787324972#step:8:29):58)
codesandbox-ci[bot] commented 10 months ago

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 14f10bc5cbe7e071c40ff313cd5142299abed294:

Sandbox Source
example Configuration
CodyJasonBennett commented 7 months ago

Thanks. Have been looking for this, apparently I never merged your PR.