re: How to write tests for a library that requires being run on the browser (like Dexie.js or localforage)? VIEW POST


If you need DOM access, some testing libraries like Jest provide a sort of pseudo-DOM that you can interact with and mock out the parts that aren't provided.

There is also JSDOM which is a Node implementation of the DOM that you could use with testing tools like Mocha/Chai that don't have built-in DOM support.

If you want full browser automation then you'll need an E2E testing tool. For that there's tools Puppeteer, I don't recommend Selenium.


I'll look into Jest & check those E2E tools out! Thanks!

code of conduct - report abuse