cmorten / cypress-web-vitals

cypress-web-vitals
MIT License
21 stars 6 forks source link

[#4] Only target first <head> reference #10

Closed cmorten closed 2 years ago

cmorten commented 2 years ago

Issue

Fixes #4.

Details

The regex for injecting the vitals script was targeting all <head> references meaning js comments (see image for godaddy in linked issue) which contained "" were also being replaced / injected into. Removing the g global flag fixes this.

Have also inlined the core web vitals script to reduce perf overhead of fetching from unpkg which should give more accurate measurements (+/- the observer effect being inevitable - https://en.wikipedia.org/wiki/Observer_effect_(physics))

CheckList