Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 729 Bytes

File metadata and controls

15 lines (8 loc) · 729 Bytes

react-testing-tanstackrouter-mocha

An example of testing a Tanstack Router React app using react-testing-library under Mocha

We needed debug why Tanstack router was not rendering pages correctly in our kotlin/js react application's mocha testing environment.

The problem turned out to be that NODE_ENV=test must be specified for Tanstack Router to function as expected in a test environment.

See react-testing-tanstackrouter-vite for the same example under Vite.

Usage

Use npm run test:mocha to run the tests with Tanstack Router not rendering pages correctly.

Use npm run test:mocha-fixed to run the tests with correct Tanstack Router behavior.