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
794 stars 103 forks source link

Add native timer clean-up behavior #407

Closed JadenSimon closed 2 years ago

JadenSimon commented 2 years ago

Purpose (TL;DR) - mandatory

See #406 for context.

Adds shouldHandleNativeTimers flag to the config (set to false by default). When enabled, calls to clear/cancel are forwarded to their real functions if the timer was not created by FakeTimers.

codecov[bot] commented 2 years ago

Codecov Report

Merging #407 (994b6df) into master (679214e) will increase coverage by 0.23%. The diff coverage is 96.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #407      +/-   ##
==========================================
+ Coverage   93.87%   94.10%   +0.23%     
==========================================
  Files           1        1              
  Lines         588      611      +23     
==========================================
+ Hits          552      575      +23     
  Misses         36       36              
Flag Coverage Δ
unit 94.10% <96.66%> (+0.23%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/fake-timers-src.js 94.10% <96.66%> (+0.23%) :arrow_up:

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 679214e...994b6df. Read the comment docs.