Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support performance.measure method #493

Open
CreativeTechGuy opened this issue Mar 13, 2024 · 0 comments
Open

Support performance.measure method #493

CreativeTechGuy opened this issue Mar 13, 2024 · 0 comments

Comments

@CreativeTechGuy
Copy link
Contributor

  • FakeTimers version : 11.2.2
  • Environment : Windows 11
  • Example URL : N/A
  • Other libraries you are using: Playwright (but should be irrelevant)

What did you expect to happen?

Faking timers with default settings (which will fake performance) should fake all of the performance methods including performance.mark, performance.measure, etc.

What actually happens

These methods exist and can be called, but seem to do nothing since calling performance.measure() returns undefined which isn't a valid return value and then the code crashes when trying to access the properties which are expected to exist on the result.

How to reproduce

const FakeTimers = await import("https://esm.sh/@sinonjs/fake-timers@11.2.2");
FakeTimers.install();
performance.mark("start");
performance.mark("end");
const measurement = performance.measure("duration", "start", "end");
console.log("duration is", measurement.duration); // Crashes here since measurement is undefined
@CreativeTechGuy CreativeTechGuy changed the title Support performance.* methods Support performance.measure method Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant