Skip to content

Conversation

@fatso83
Copy link
Contributor

@fatso83 fatso83 commented Sep 10, 2024

Purpose (TL;DR) - mandatory

This PR tries to upgrade Fake Timers to the latest version. This has a number of breaking changes,
one of which affects the bundling, as Browserify does not provide shims for all the required
dependencies, thus failing the build with something like this:

 ❯ node build.cjs
/Users/carlerik/dev/sinon/build.cjs:29
            throw err;
            ^

[Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat '/Users/carlerik/dev/sinon/timers'
    required by /Users/carlerik/dev/sinon/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '/Users/carlerik/dev/sinon/timers',

Therefore we should transition to esbuild, which is already being used in the mochify scripts.

How to verify - mandatory

  1. Check out this branch
  2. npm install

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

This was originally added (really rectified) in commit ac17669 (2013) when Sinon's fake-timers code allowed installing non-standard/unknown timers.

Since the latest fake-timers no longer allows this, we have to do the test against a real/existing timer that the library knows about.
@socket-security
Copy link

socket-security bot commented Sep 10, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@sinonjs/[email protected] eval 0 96.8 kB fatso83
npm/[email protected] environment, filesystem, shell Transitive: eval, unsafe +34 5.66 MB oss-bot
npm/[email protected] None 0 621 kB explodingcabbage
npm/[email protected] environment, filesystem, unsafe Transitive: eval, shell +86 6.56 MB bcoe
npm/[email protected] environment, filesystem Transitive: shell +26 3.61 MB isaacs

🚮 Removed packages: npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

@fatso83 fatso83 marked this pull request as ready for review September 11, 2024 07:30
@fatso83 fatso83 merged commit 912c568 into main Sep 11, 2024
@fatso83 fatso83 deleted the upgrade-fake-timers-and-others branch September 11, 2024 07:31
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

Successfully merging this pull request may close these issues.

2 participants