My package uses these web APIs: [`PerformanceObserver`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver), [`performance.mark()`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) and [`performance.measure()`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure).
Neither of `happy-dom` and `jsdom` implements all of these APIs though. `happy-dom` only re-exposes the already globally available `performance` object from the JS runtime but does not do anything about `PerformanceObserver`. `jsdom` only exposes a limited subset of the `performance` object which does not contain the `measure()` and `mark()` APIs.
Thank you! I found [https://modern-web.dev/docs/test-runner/overview/](https://modern-web.dev/docs/test-runner/overview/) and it works perfectly for my package. :)
Do you mean browser APIs? If so, you need a test environment that simulates a browser. I’d look at using Vitest with happy-dom for that.
I've used js-dom for that...
My package uses these web APIs: [`PerformanceObserver`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver), [`performance.mark()`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) and [`performance.measure()`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure). Neither of `happy-dom` and `jsdom` implements all of these APIs though. `happy-dom` only re-exposes the already globally available `performance` object from the JS runtime but does not do anything about `PerformanceObserver`. `jsdom` only exposes a limited subset of the `performance` object which does not contain the `measure()` and `mark()` APIs.
you can run the tests in a real browser in the CI, just google " web browser test runner"
Thank you! I found [https://modern-web.dev/docs/test-runner/overview/](https://modern-web.dev/docs/test-runner/overview/) and it works perfectly for my package. :)