cucumber-js icon indicating copy to clipboard operation
cucumber-js copied to clipboard

consolidate timing code

Open davidjgoss opened this issue 2 years ago • 1 comments

🤔 What's the problem you've observed?

We have two areas doing similar work in different places:

  • https://github.com/cucumber/cucumber-js/blob/main/src/runtime/stopwatch.ts
  • https://github.com/cucumber/cucumber-js/blob/main/src/time.ts

The former uses a third-party library as well. I think there is some duplication here, and it's confusing for contributors to understand what's doing what.

✨ Do you have a proposal for making it better?

Review in detail, refactor so there's a single source of truth for timing-related stuff. Possibly drop the third-party dependency now - I think we brought that in before performance.now() was a thing, so it might be a little redundant.

📚 Any additional context?

Observed when working on https://github.com/cucumber/cucumber-js/issues/2086.


This text was originally generated from a template, then edited by hand. You can modify the template here.

davidjgoss avatar Jul 28 '22 18:07 davidjgoss

For awareness, the history of src/time.ts is based on allowing people to mock out time in their tests and cucumber to still record the time for steps.

https://github.com/cucumber/cucumber-js/blob/main/features/fake_time.feature

A lot has changed since then haha.

charlierudolph avatar Jul 30 '22 21:07 charlierudolph