Skip to main content

Browser environment

When to test

  • Your package runs in a browser

What to test

Test that your package works in a browser environment. This is especially important if your package can also run in Node.js, since there are many differences between the two environments.

How to set up

There are many ways to set this up. If you’re using Jest, you can use its testEnvironment configuration option. For more rigorous testing, you can use a headless browser through a library like Puppeteer.

Common problems to watch for

TODO