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.
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.