vercel / speed-insights

Vercel Speed Insights package
https://vercel.com/docs/speed-insights
Apache License 2.0
54 stars 6 forks source link

fix(web): injectSpeedInsights requires a parameter value #38

Closed feugy closed 5 months ago

feugy commented 5 months ago

๐Ÿ““ What's in there?

Fixes #32, #34

There's no strong reason for forcing users to provide a framework when they directly use injectSpeedInsights(). This PR sets a default empty value.

๐Ÿงช How to test?

Some new unit tests: pnpm t

โ— Notes to reviewers

I added very basic unit tests for this change, which will make it easier in the future for writing other, more valuable tests.

All tests are running in jsdom environment, except one, which uses node environment, to simulate server-side rendering. This forced me to adjust the beforeEach() in packages/web/jest.setup.ts.

On my VSCode I'm getting many Unsafe call of ananytyped value.eslint@typescript-eslint/no-unsafe-call errors in test files, which we don't see when running pnpm -F @vercel/speed-insights lint Is it the same for you @tobiaslins? I updated a couple types, but it didn't solved it.

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
speed-insights-astro โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 12, 2024 10:51am
speed-insights-nextjs โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 12, 2024 10:51am
speed-insights-nuxt โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 12, 2024 10:51am
speed-insights-remix โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 12, 2024 10:51am
speed-insights-sveltekit โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 12, 2024 10:51am
speed-insights-vue โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Jan 12, 2024 10:51am