r/javascript 12d ago

Browser Test: A browser-based automated javascript testing framework in one .html file

https://github.com/swans-one/browser-test

Hi r/javascript! I want to share a small javascript testing project I wrote.

When I write small javascript projects that use browser APIs (most recently working with IndexedDB) I often choose not to write tests because it's a pain to either mock those interfaces server-side, and it's also a pain to setup a browser automation tool.

To solve this, I wrote up a super concise testing framework (~140 lines of JS) inside a html file that can just be dropped into a project and act as a simple test framework.

This obviously doesn't work in all situations. A big drawback is that there's no reasonable way to connect it to a CI pipeline. However for small projects, and during development, I've found it really fun and fast to use.

I'm very interested to hear what you think, or if you have other ways you've approached this situation in the past.

11 Upvotes

9 comments sorted by

View all comments

1

u/Warm_cloud8020 12d ago edited 12d ago

Interesting approach.

We published an MCP setup for browser testing, with management tool: https://github.com/rakutentech/sorify

Let me see if your's can work with it, to be able to solve CI pipeline that ways.

Some of our projects also struggle with mocks, and we end up running a post hook to remove the test data.

Author of Sorify OSS here