Search code examples
reactjsreact-testing-librarycodesandbox

Issue with React-Testing-Library in codesandbox.io


I am a relative noob to React. Wanted to practice some tdd in this sandbox basic react sandbox. It seems that the test code is affecting app component state If you switch between Browser and Tests you'll see test items being added to the list - even though i am running render and cleanup in the tests.

Not sure what I am doing wrong?


Solution

  • Codesandbox has some problems running the tests. That's because they run in the browser and not in a separate jsdom environment. I suggest you run the tests in your machine instead.