sinonjs / fake-timers

Fake setTimeout and friends (collectively known as "timers"). Useful in your JavaScript tests. Extracted from Sinon.JS
BSD 3-Clause "New" or "Revised" License
802 stars 105 forks source link

Support `temporal` TC39 proposal #335

Open SimenB opened 4 years ago

SimenB commented 4 years ago

Repo: https://github.com/tc39/proposal-temporal/

We should support faking out usage of all Temporal.now.* methods. Not sure if we need to fake anything else?

Note that I do not think we should support Temporal now - the proposal is still at stage 2. So consider this more of a tracking issue than something that's actionable right now.

What did you expect to happen? N/A

What actually happens N/A

How to reproduce N/A

benjamingr commented 4 years ago

Cc @littledan I remember you asking for feedback on Temporal.

Is there anything other than .now that sinon would need to fake?

SimenB commented 3 years ago

It's now stage 3: https://github.com/tc39/proposal-temporal/pull/1440. 🎉 Is this a good time to add support? Along with some docs caveat that it's still unstable (and of course not added to toFake by default). Or should we wait for one engine to land it?

benjamingr commented 3 years ago

When does it land in Chrome?

SimenB commented 3 years ago

I have exactly zero clue 😅

ljharb commented 3 years ago

It is stage 3, but will not be shipped unflagged at this time, so it'll be awhile.

You will only have to mock out Temporal.now, by design.

I would start implementing now, but perhaps hold off shipping it until at least one engine has landed it, or at least until a production-ready spec-compliant polyfill exists.

SimenB commented 3 years ago

You will only have to mock out Temporal.now, by design.

Wonderful 👍

I would start implementing now, but perhaps hold off shipping it until at least one engine has landed it, or at least until a production-ready spec-compliant polyfill exists.

If somebody is up for implementing it, I think we can also ship it as long as it's clearly marked as unstable in docs and possibly code, e.g. unstable_enableTemporalSupport: boolean or something. Not sure, and I don't feel strongly

fatso83 commented 5 hours ago

Still Stage 3. Not implemented by any browsers, yet.