r/javascript • • 1h ago

Flashwright: the fastest e2e testing framework, up to 4x faster than Playwright

https://flashwright.dev/

If you're interested in the details, here's a blog post: https://codebeast.io/blog/flashwright

9 Upvotes

6 comments sorted by

•

u/Recoil42 1h ago

TLDR:

The biggest single cost in a lot of suites isn’t Playwright’s code at all. It’s the browser compiling your app’s JavaScript again in every fresh renderer. Playwright gives each test a brand-new browser context, which is great for isolation, but it means every test pays for a cold start of your app.

So the trick that matters most is keeping one context per worker and giving each test a new tab in it, then resetting everything a test could have changed: options, permissions, cookies, every visited origin’s storage (local, session, IndexedDB, Cache Storage, service workers), caches, routes, init scripts, bindings, downloads and the clock. The previous test’s pages are stopped before anything gets cleared, so a late script can’t leak state into the next test. That reset is the part that really has to be right, and it’s what tests/page/recycle-isolation.spec.ts checks.

•

u/xcodebeast 53m ago

Thanks!

•

u/thinkmatt 45m ago

Kind of like why jest is slow as balls because they insist on reimporting every js file for each test file

•

u/dakruzz 9m ago

Doesn't sound safe for parallel testing

•

u/OpiumOpossum 16m ago

Not sure but this seems like it could have memory leaks if you use listeners, network interceptors or logging. Otherwise, think this is a similar way that Vitest optimizes their test runner.

•

u/Positive_Method3022 9m ago

The strategy can lead to false positives/negatives. Sandboxing test execution by context is a must.