Files
privacy.sexy/tests/unit/shared/Stubs/TimeoutStub.ts
undergroundwires 25d7f7b2a4 Bump dependencies to latest
This commit updates various dependencies to their latest versions.

Other changes include:

- Moved the following from `devDependencies` to `dependencies`:
  - `electron-log`
  - `electron-updater`
- Remove `npm` dependency.
- Code changes:
  - Add type casting in several places to align with the latest
    `typescript` version.
  - Adopt to new return type of `setTimeout`.
- Dependencies not upgraded due to
  `@vue/eslint-config-airbnb-with-typescript` not supporting
  `@eslint-typescript` V6 (see vuejs/eslint-config-airbnb#58):
  - `vue/eslint-config-typescript`
  - `@typescript-eslint/eslint-plugin`
  - `@typescript-eslint/parser`
- Enable video recording for cypress as it's disabled by default since
  13.X.X.
2023-10-16 02:06:19 +02:00

14 lines
490 B
TypeScript

export function createMockTimeout(timerId: number): ReturnType<typeof setTimeout> {
const throwErrorForNodeOperation = () => {
throw new Error('node specific operation was called');
};
return {
[Symbol.toPrimitive]: () => timerId,
[Symbol.dispose]: throwErrorForNodeOperation, // Cancels the timeout in node
hasRef: throwErrorForNodeOperation,
refresh: throwErrorForNodeOperation,
ref: throwErrorForNodeOperation,
unref: throwErrorForNodeOperation,
};
}