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

Rename package to @sinonjs/fake-timers #293

Closed mroderick closed 4 years ago

mroderick commented 4 years ago

This PR renames the package to @sinonjs/fake-clock.

Purpose

It was suggested that we rename this package to have a less confusing name (I can't recall who suggested it, or in which communication channel).

I will soon be doing a larger effort in improving the documentation of Sinon and associated libraries. I thought it would be beneficial to that effort to get the rename of packages out of the way first.

See https://github.com/sinonjs/sinon/issues/1651

Plan

  1. Rename repository
  2. Merge this branch
  3. Bump the major version
  4. Publish the renamed package to npm registry
  5. Deprecate the lolex package in the npm registry
  6. Update sinon to use the new package

How to verify

  1. Check out this branch
  2. (this repo): npm ci
  3. (this repo): npm link
  4. (sinon repo): npm link @sinonjs/fake-clock
  5. (sinon repo): Update the lib/sinon/util/fake-timers.js to use @sinonjs/fake-clock instead of lolex
  6. (sinon repo): npm test
  7. Observe tests pass
mantoni commented 4 years ago

I guess we‘ll rename nise to @sinonjs/fake-xhr?

mroderick commented 4 years ago

I guess we‘ll rename nise to @sinonjs/fake-xhr?

https://github.com/sinonjs/nise/pull/131 ... let's discuss that package in that PR

mantoni commented 4 years ago

Sorry to come up with this so late, after the work has already been done, but I'd like to discuss if @sinonjs/fake-timers would be an even better name since it would match sinon.useFakeTimers(). What do you think?

mroderick commented 4 years ago

Sorry to come up with this so late, after the work has already been done, but I'd like to discuss if @sinonjs/fake-timers would be an even better name since it would match sinon.useFakeTimers(). What do you think?

That also works. I don't really have a preference. What says @SimenB and @fatso83?

codecov[bot] commented 4 years ago

Codecov Report

Merging #293 into master will decrease coverage by 0.02%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
- Coverage   92.61%   92.59%   -0.03%     
==========================================
  Files           1        1              
  Lines         542      540       -2     
==========================================
- Hits          502      500       -2     
  Misses         40       40
Flag Coverage Δ
#unit 92.59% <100%> (-0.03%) :arrow_down:
Impacted Files Coverage Δ
src/fake-timers-src.js 92.59% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6a1248c...81bbaeb. Read the comment docs.

mroderick commented 4 years ago

This fails in master for me: npm run test-cloud.

Until I have a chance to fix that, I am not going to publish a release under the new name.

mantoni commented 4 years ago

Aaah, our favorite browser screaming for attention again 😟 👶

mroderick commented 4 years ago

This has been published to npm as @sinonjs/fake-timers@6.0.0.

@SimenB let us know how it goes with using the package in the Jest timers package?

SimenB commented 4 years ago

The only "breaking" change was the rename, right? If yes, happy to update 🙂

mroderick commented 4 years ago

I've published the last commit 6a1248cf02867d76cf596b299ed74841eceff236 before the rename as lolex@6.0.0.

I have deprecated with the following command:

npm deprecate lolex@6.0.0 "lolex has been renamed to @sinonjs/fake-timers. No API changes made. Please use the new package instead"
mroderick commented 4 years ago

The only "breaking" change was the rename, right? If yes, happy to update

Yep. Only a rename. No other changes made.

SimenB commented 4 years ago

perfect! 🙂

EDIT: Actually, we'll be stuck until a version of the types is published to from DefinitelyTyped... Should we just ship with typings? #220

mroderick commented 4 years ago

EDIT: Actually, we'll be stuck until a version of the types is published to from DefinitelyTyped... Should we just ship with typings? #220

Yes, and no. I am doing some work this month that hopefully will result in:

  1. Better API documentation for the projects
  2. Better support in IDEs like VSCode / IntelliJ
  3. Enabling automatic generation of the TypeScript artefacts, instead of that being a manual process

It's part of a longer effort, more to come.

(If you put an oar in this water, be prepared to pull on it).

fatso83 commented 3 years ago

See #365