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.
This commit is contained in:
2
.github/actions/setup-node/action.yml
vendored
2
.github/actions/setup-node/action.yml
vendored
@@ -3,6 +3,6 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
|||||||
6
.github/workflows/checks.build.yaml
vendored
6
.github/workflows/checks.build.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
@@ -78,7 +78,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Install Docker on macOS
|
name: Install Docker on macOS
|
||||||
if: matrix.os == 'macos' # macOS runner is missing Docker
|
if: matrix.os == 'macos' # macOS runner is missing Docker
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
2
.github/workflows/checks.external-urls.yaml
vendored
2
.github/workflows/checks.external-urls.yaml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
2
.github/workflows/checks.quality.yaml
vendored
2
.github/workflows/checks.quality.yaml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
4
.github/workflows/checks.scripts.yaml
vendored
4
.github/workflows/checks.scripts.yaml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
2
.github/workflows/checks.security.sast.yaml
vendored
2
.github/workflows/checks.security.sast.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Initialize CodeQL
|
name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
|
|||||||
2
.github/workflows/release.desktop.yaml
vendored
2
.github/workflows/release.desktop.yaml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}-latest
|
runs-on: ${{ matrix.os }}-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: master # otherwise it defaults to the version tag missing bump commit
|
ref: master # otherwise it defaults to the version tag missing bump commit
|
||||||
fetch-depth: 0 # fetch all history
|
fetch-depth: 0 # fetch all history
|
||||||
|
|||||||
4
.github/workflows/release.site.yaml
vendored
4
.github/workflows/release.site.yaml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: "Infrastructure: Checkout"
|
name: "Infrastructure: Checkout"
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: aws
|
path: aws
|
||||||
repository: undergroundwires/aws-static-site-with-cd
|
repository: undergroundwires/aws-static-site-with-cd
|
||||||
@@ -75,7 +75,7 @@ jobs:
|
|||||||
working-directory: aws
|
working-directory: aws
|
||||||
-
|
-
|
||||||
name: "App: Checkout"
|
name: "App: Checkout"
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
path: app
|
path: app
|
||||||
ref: master # otherwise we don't get version bump commit
|
ref: master # otherwise we don't get version bump commit
|
||||||
|
|||||||
2
.github/workflows/tests.e2e.yaml
vendored
2
.github/workflows/tests.e2e.yaml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
2
.github/workflows/tests.integration.yaml
vendored
2
.github/workflows/tests.integration.yaml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Setup node
|
name: Setup node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
2
.github/workflows/tests.unit.yaml
vendored
2
.github/workflows/tests.unit.yaml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set-up node
|
name: Set-up node
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ const CYPRESS_BASE_DIR = 'tests/e2e/';
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
fixturesFolder: `${CYPRESS_BASE_DIR}/fixtures`,
|
fixturesFolder: `${CYPRESS_BASE_DIR}/fixtures`,
|
||||||
screenshotsFolder: `${CYPRESS_BASE_DIR}/screenshots`,
|
screenshotsFolder: `${CYPRESS_BASE_DIR}/screenshots`,
|
||||||
|
|
||||||
|
video: true,
|
||||||
videosFolder: `${CYPRESS_BASE_DIR}/videos`,
|
videosFolder: `${CYPRESS_BASE_DIR}/videos`,
|
||||||
|
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: `http://localhost:${ViteConfig.server.port}/`,
|
baseUrl: `http://localhost:${ViteConfig.server.port}/`,
|
||||||
specPattern: `${CYPRESS_BASE_DIR}/**/*.cy.{js,jsx,ts,tsx}`, // Default: cypress/e2e/**/*.cy.{js,jsx,ts,tsx}
|
specPattern: `${CYPRESS_BASE_DIR}/**/*.cy.{js,jsx,ts,tsx}`, // Default: cypress/e2e/**/*.cy.{js,jsx,ts,tsx}
|
||||||
|
|||||||
9284
package-lock.json
generated
9284
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
66
package.json
66
package.json
@@ -36,18 +36,19 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/vue": "^1.0.2",
|
"@floating-ui/vue": "^1.0.2",
|
||||||
"@juggle/resize-observer": "^3.4.0",
|
"@juggle/resize-observer": "^3.4.0",
|
||||||
"ace-builds": "^1.23.4",
|
"ace-builds": "^1.30.0",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
|
"electron-log": "^4.4.8",
|
||||||
"electron-progressbar": "^2.1.0",
|
"electron-progressbar": "^2.1.0",
|
||||||
|
"electron-updater": "^6.1.4",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.2",
|
||||||
"npm": "^9.8.1",
|
|
||||||
"vue": "^2.7.14"
|
"vue": "^2.7.14"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@modyfi/vite-plugin-yaml": "^1.0.4",
|
"@modyfi/vite-plugin-yaml": "^1.0.4",
|
||||||
"@rushstack/eslint-patch": "^1.3.2",
|
"@rushstack/eslint-patch": "^1.5.1",
|
||||||
"@types/ace": "^0.0.48",
|
"@types/ace": "^0.0.49",
|
||||||
"@types/file-saver": "^2.0.5",
|
"@types/file-saver": "^2.0.5",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||||
"@typescript-eslint/parser": "^5.62.0",
|
"@typescript-eslint/parser": "^5.62.0",
|
||||||
@@ -56,47 +57,42 @@
|
|||||||
"@vue/eslint-config-airbnb-with-typescript": "^7.0.0",
|
"@vue/eslint-config-airbnb-with-typescript": "^7.0.0",
|
||||||
"@vue/eslint-config-typescript": "^11.0.3",
|
"@vue/eslint-config-typescript": "^11.0.3",
|
||||||
"@vue/test-utils": "^1.3.6",
|
"@vue/test-utils": "^1.3.6",
|
||||||
"autoprefixer": "^10.4.15",
|
"autoprefixer": "^10.4.16",
|
||||||
"cypress": "^12.17.2",
|
"cypress": "^13.3.1",
|
||||||
"electron": "^25.3.2",
|
"electron": "^27.0.0",
|
||||||
"electron-builder": "^24.6.3",
|
"electron-builder": "^24.6.4",
|
||||||
"electron-devtools-installer": "^3.2.0",
|
"electron-devtools-installer": "^3.2.0",
|
||||||
"electron-icon-builder": "^2.0.1",
|
"electron-icon-builder": "^2.0.1",
|
||||||
"electron-log": "^4.4.8",
|
|
||||||
"electron-updater": "^6.1.4",
|
|
||||||
"electron-vite": "^1.0.27",
|
"electron-vite": "^1.0.27",
|
||||||
"eslint": "^8.46.0",
|
"eslint": "^8.51.0",
|
||||||
"eslint-plugin-cypress": "^2.14.0",
|
"eslint-plugin-cypress": "^2.15.1",
|
||||||
"eslint-plugin-vue": "^9.6.0",
|
"eslint-plugin-vue": "^9.17.0",
|
||||||
"eslint-plugin-vuejs-accessibility": "^1.2.0",
|
"eslint-plugin-vuejs-accessibility": "^2.2.0",
|
||||||
"icon-gen": "^3.0.1",
|
"icon-gen": "^4.0.0",
|
||||||
"jsdom": "^22.1.0",
|
"jsdom": "^22.1.0",
|
||||||
"markdownlint-cli": "^0.35.0",
|
"markdownlint-cli": "^0.37.0",
|
||||||
"postcss": "^8.4.28",
|
"postcss": "^8.4.31",
|
||||||
"remark-cli": "^11.0.0",
|
"remark-cli": "^12.0.0",
|
||||||
"remark-lint-no-dead-urls": "^1.1.0",
|
"remark-lint-no-dead-urls": "^1.1.0",
|
||||||
"remark-preset-lint-consistent": "^5.1.2",
|
"remark-preset-lint-consistent": "^5.1.2",
|
||||||
"remark-validate-links": "^12.1.1",
|
"remark-validate-links": "^13.0.0",
|
||||||
"sass": "^1.64.1",
|
"sass": "^1.69.3",
|
||||||
"start-server-and-test": "^2.0.0",
|
"start-server-and-test": "^2.0.1",
|
||||||
"svgexport": "^0.4.2",
|
"svgexport": "^0.4.2",
|
||||||
"terser": "^5.19.2",
|
"terser": "^5.21.0",
|
||||||
"tslib": "~2.4.0",
|
"tslib": "^2.6.2",
|
||||||
"typescript": "~4.6.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^4.4.9",
|
"vite": "^4.4.11",
|
||||||
"vitest": "^0.34.2",
|
"vitest": "^0.34.6",
|
||||||
"vue-tsc": "^1.8.8",
|
"vue-tsc": "^1.8.19",
|
||||||
"yaml-lint": "^1.7.0"
|
"yaml-lint": "^1.7.0"
|
||||||
},
|
},
|
||||||
"//devDependencies": {
|
"//devDependencies": {
|
||||||
"terser": "Used by @vitejs/plugin-legacy for minification",
|
"terser": "Used by @vitejs/plugin-legacy for minification",
|
||||||
"typescript": [
|
"@rushstack/eslint-patch": "Needed by @vue/eslint-config-typescript",
|
||||||
"Cannot upgrade to 5.X.X due to unmaintained @vue/cli-plugin-typescript, https://github.com/vuejs/vue-cli/issues/7401",
|
"@vue/eslint-config-typescript": "Cannot upgrade to 12.X.X due to @vue/eslint-config-airbnb-with-typescript, https://github.com/vuejs/eslint-config-airbnb/issues/58",
|
||||||
"Cannot upgrade to > 4.6.X otherwise unit tests do not work, https://github.com/evanw/node-source-map-support/issues/252"
|
"@typescript-eslint/eslint-plugin": "Cannot upgrade to 6.X.X due to @vue/eslint-config-airbnb-with-typescript, https://github.com/vuejs/eslint-config-airbnb/issues/58",
|
||||||
],
|
"@typescript-eslint/parser": "Cannot upgrade to 6.X.X due to @vue/eslint-config-airbnb-with-typescript, https://github.com/vuejs/eslint-config-airbnb/issues/58"
|
||||||
"tslib": "Cannot upgrade to > 2.4.X otherwise unit tests do not work, https://github.com/evanw/node-source-map-support/issues/252",
|
|
||||||
"@typescript-eslint/eslint-plugin": "Cannot upgrade to 6.X.X due to @vue/eslint-config-typescript, https://github.com/vuejs/eslint-config-typescript/pull/60",
|
|
||||||
"@typescript-eslint/parser": "Cannot upgrade to 6.X.X due to @vue/eslint-config-typescript, https://github.com/vuejs/eslint-config-typescript/pull/60"
|
|
||||||
},
|
},
|
||||||
"homepage": "https://privacy.sexy",
|
"homepage": "https://privacy.sexy",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ describe('Script', () => {
|
|||||||
describe('level', () => {
|
describe('level', () => {
|
||||||
it('cannot construct with invalid wrong value', () => {
|
it('cannot construct with invalid wrong value', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const invalidValue: RecommendationLevel = 55;
|
const invalidValue: RecommendationLevel = 55 as never;
|
||||||
const expectedError = 'invalid level';
|
const expectedError = 'invalid level';
|
||||||
// act
|
// act
|
||||||
const construct = () => new ScriptBuilder()
|
const construct = () => new ScriptBuilder()
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe('ScriptingDefinition', () => {
|
|||||||
});
|
});
|
||||||
it('throws if unknown', () => {
|
it('throws if unknown', () => {
|
||||||
// arrange
|
// arrange
|
||||||
const unknownValue: ScriptingLanguage = 666;
|
const unknownValue: ScriptingLanguage = 666 as never;
|
||||||
const errorMessage = `unsupported language: ${unknownValue}`;
|
const errorMessage = `unsupported language: ${unknownValue}`;
|
||||||
// act
|
// act
|
||||||
const act = () => new ScriptingDefinitionBuilder()
|
const act = () => new ScriptingDefinitionBuilder()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { TimeFunctions, TimeoutDelayScheduler } from '@/presentation/components/Scripts/View/Tree/TreeView/Rendering/Scheduling/TimeoutDelayScheduler';
|
import { TimeFunctions, TimeoutDelayScheduler } from '@/presentation/components/Scripts/View/Tree/TreeView/Rendering/Scheduling/TimeoutDelayScheduler';
|
||||||
import { StubWithObservableMethodCalls } from '@tests/unit/shared/Stubs/StubWithObservableMethodCalls';
|
import { StubWithObservableMethodCalls } from '@tests/unit/shared/Stubs/StubWithObservableMethodCalls';
|
||||||
|
import { createMockTimeout } from '@tests/unit/shared/Stubs/TimeoutStub';
|
||||||
|
|
||||||
describe('TimeoutDelayScheduler', () => {
|
describe('TimeoutDelayScheduler', () => {
|
||||||
describe('scheduleNext', () => {
|
describe('scheduleNext', () => {
|
||||||
@@ -56,7 +57,8 @@ describe('TimeoutDelayScheduler', () => {
|
|||||||
expect(setTimeoutCalls.length).toBe(2);
|
expect(setTimeoutCalls.length).toBe(2);
|
||||||
const clearTimeoutCalls = timerStub.callHistory.filter((c) => c.methodName === 'clearTimeout');
|
const clearTimeoutCalls = timerStub.callHistory.filter((c) => c.methodName === 'clearTimeout');
|
||||||
expect(clearTimeoutCalls.length).toBe(1);
|
expect(clearTimeoutCalls.length).toBe(1);
|
||||||
const [actualId] = clearTimeoutCalls[0].args;
|
const [timeout] = clearTimeoutCalls[0].args;
|
||||||
|
const actualId = Number(timeout);
|
||||||
expect(actualId).toBe(idOfFirstSetTimeoutCall);
|
expect(actualId).toBe(idOfFirstSetTimeoutCall);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -78,6 +80,7 @@ class TimeFunctionsStub
|
|||||||
methodName: 'setTimeout',
|
methodName: 'setTimeout',
|
||||||
args: [callback, delayInMs],
|
args: [callback, delayInMs],
|
||||||
});
|
});
|
||||||
return this.callHistory.filter((c) => c.methodName === 'setTimeout').length as unknown as ReturnType<typeof setTimeout>;
|
const id = this.callHistory.filter((c) => c.methodName === 'setTimeout').length;
|
||||||
|
return createMockTimeout(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { throttle, ITimer, TimeoutType } from '@/presentation/components/Shared/
|
|||||||
import { EventSource } from '@/infrastructure/Events/EventSource';
|
import { EventSource } from '@/infrastructure/Events/EventSource';
|
||||||
import { IEventSubscription } from '@/infrastructure/Events/IEventSource';
|
import { IEventSubscription } from '@/infrastructure/Events/IEventSource';
|
||||||
import { getAbsentObjectTestCases, itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
import { getAbsentObjectTestCases, itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||||
|
import { createMockTimeout } from '@tests/unit/shared/Stubs/TimeoutStub';
|
||||||
|
|
||||||
describe('throttle', () => {
|
describe('throttle', () => {
|
||||||
describe('validates parameters', () => {
|
describe('validates parameters', () => {
|
||||||
@@ -153,7 +154,7 @@ class TimerMock implements ITimer {
|
|||||||
});
|
});
|
||||||
this.subscriptions.push(subscription);
|
this.subscriptions.push(subscription);
|
||||||
const id = this.subscriptions.length - 1;
|
const id = this.subscriptions.length - 1;
|
||||||
return TimerMock.mockTimeout(id);
|
return createMockTimeout(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearTimeout(timeoutId: TimeoutType): void {
|
public clearTimeout(timeoutId: TimeoutType): void {
|
||||||
@@ -172,15 +173,4 @@ class TimerMock implements ITimer {
|
|||||||
this.currentTime = ms;
|
this.currentTime = ms;
|
||||||
this.timeChanged.notify(this.currentTime);
|
this.timeChanged.notify(this.currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static mockTimeout(subscriptionId: number): TimeoutType {
|
|
||||||
const throwNodeSpecificCode = () => { throw new Error('node specific code'); };
|
|
||||||
return {
|
|
||||||
[Symbol.toPrimitive]: () => subscriptionId,
|
|
||||||
hasRef: throwNodeSpecificCode,
|
|
||||||
refresh: throwNodeSpecificCode,
|
|
||||||
ref: throwNodeSpecificCode,
|
|
||||||
unref: throwNodeSpecificCode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
13
tests/unit/shared/Stubs/TimeoutStub.ts
Normal file
13
tests/unit/shared/Stubs/TimeoutStub.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user