Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PageLoader to run tests w/ JSDOM & the browser
PageLoader, in test-helpers.js, enables running the same tests whether running in Node with JSDOM or running in a browser. It also provides PageLoader.closeAll() for easy afterEach() cleanup. Its JsdomPageLoader contains the previous loadFromFile() and importModules() logic from main.test.js. It's also redesigned to be much more consistent, as extensively documented in the comments. Now it's possible to run the tests using the Vitest browser runner via: pnpm test -- --browser.name=chrome (Or "firefox"; "safari" seems a bit broken at the moment.) --- However, it's not yet possible to run headless via: pnpm test -- --browser.name=chrome --browser.headless This is because this change adds @vitest/browser v0.34.6, the latest non beta version, which doesn't contain: - vitest-dev/vitest#4364 That PR passes the options that enable headless mode through to the BrowserProvider implementations, thus closing: - vitest-dev/vitest#3930 However, the change is only present from v1.0.0-beta.3: - vitest-dev/vitest@5cdeb55 - https://github.com/vitest-dev/vitest/releases/tag/v1.0.0-beta.3 I'll try updating to v1.0.0-beta.4 (the latest at this time). If that works, I'll commit it.
- Loading branch information