Skip to content

Commit 4534d04

Browse files
authored
fix: pin @sinonjs/fake-timers type resolution in bundled sinon types (#33886)
* fix: pin @sinonjs/fake-timers type resolution in bundled sinon types Cypress ships @types/sinon in its npm package via cli/scripts/sync-typedefs.ts. The upstream file imports types from '@sinonjs/fake-timers', which TypeScript will resolve to a user-installed copy of that package when present — newer versions (15.3+) reorganized exports and break Cypress's bundled @types/sinonjs__fake-timers, surfacing as TS2694 at user build time. Patch the upstream import to use the @types name 'sinonjs__fake-timers' directly so resolution always lands on the version Cypress ships, regardless of what the user has installed.
1 parent d7cd85a commit 4534d04

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎cli/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- Fixed an issue where clicking "back to projects" or switching projects while a project's initial config load was still in flight could fail. Fixed in [#33810](https://github.com/cypress-io/cypress/pull/33810).
1515
- Fixed an intermittent `ENOENT: no such file or directory, open <path>/bundle.tar-<rand>` error during `cy.prompt` and Studio bundle initialization. Fixed in [#33748](https://github.com/cypress-io/cypress/pull/33748).
1616
- Fixed a regression in [14.3.3](#14-3-3) where deleting `results.video` in `after:spec` to keep videos only for failing specs could leave an empty `*-compressed.mp4` file in `cypress/videos`. Fixes [#32883](https://github.com/cypress-io/cypress/issues/32883).
17+
- Fixed an issue where Cypress's bundled TypeScript type definitions could fail to compile in a project that also installed `@sinonjs/fake-timers@>=15.3.0`, because the bundled `@types/sinon` file imported `FakeTimers` from `@sinonjs/fake-timers` and TypeScript would prefer the user's installed copy over the bundled `@types/sinonjs__fake-timers`. The shipped types now reference the `@types` package directly so resolution is independent of the user's installed version. Fixes [#33829](https://github.com/cypress-io/cypress/issues/33829). Fixed in [#33886](https://github.com/cypress-io/cypress/pull/33886).
1718

1819
**Dependency Updates:**
1920

‎cli/patches/@types+sinon+9.0.9.patch‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ diff --git a/node_modules/@types/sinon/index.d.ts b/node_modules/@types/sinon/in
22
index 07ba706..fd32cbe 100644
33
--- a/node_modules/@types/sinon/index.d.ts
44
+++ b/node_modules/@types/sinon/index.d.ts
5+
@@ -12,7 +12,9 @@
6+
// Roey Berman <https://github.com/bergundy>
7+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8+
9+
-import * as FakeTimers from '@sinonjs/fake-timers';
10+
+// Import via the @types name so TS resolves to the bundled
11+
+// @types/sinonjs__fake-timers (cypress-io/cypress#33829).
12+
+import * as FakeTimers from 'sinonjs__fake-timers';
13+
14+
// sinon uses DOM dependencies which are absent in browser-less environment like node.js
15+
// to avoid compiler errors this monkey patch is used
516
@@ -45,7 +45,7 @@ declare namespace Sinon {
617
* so a call that received the provided arguments (in the same spots) and possibly others as well will return true.
718
* @param args

0 commit comments

Comments
 (0)