Documentation
Legacy Sandboxes
Tests

Tests

How do Browser Sandboxes run tests?

CodeSandbox uses Jest (opens in a new tab) library to run the tests directly in the browser. That means you can write tests, but adding additional plugins is not possible in the Client Sandbox experience.


How to write tests in the CodeSandbox Browser Sandboxes

In Browser sandboxes you can run Jest tests by creating files that end with .test.js, .spec.js, .test.ts(x) and .spec.js(x). We will automatically detect these test files and show the results in the Tests tab.

Note: In Container sandboxes you can still use Jest (or whichever test framework you want), but we don't auto-detect these and you'd need to set it up yourself as you would locally.

Test Bottom