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:
@@ -59,7 +59,7 @@ describe('Script', () => {
|
||||
describe('level', () => {
|
||||
it('cannot construct with invalid wrong value', () => {
|
||||
// arrange
|
||||
const invalidValue: RecommendationLevel = 55;
|
||||
const invalidValue: RecommendationLevel = 55 as never;
|
||||
const expectedError = 'invalid level';
|
||||
// act
|
||||
const construct = () => new ScriptBuilder()
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('ScriptingDefinition', () => {
|
||||
});
|
||||
it('throws if unknown', () => {
|
||||
// arrange
|
||||
const unknownValue: ScriptingLanguage = 666;
|
||||
const unknownValue: ScriptingLanguage = 666 as never;
|
||||
const errorMessage = `unsupported language: ${unknownValue}`;
|
||||
// act
|
||||
const act = () => new ScriptingDefinitionBuilder()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { TimeFunctions, TimeoutDelayScheduler } from '@/presentation/components/Scripts/View/Tree/TreeView/Rendering/Scheduling/TimeoutDelayScheduler';
|
||||
import { StubWithObservableMethodCalls } from '@tests/unit/shared/Stubs/StubWithObservableMethodCalls';
|
||||
import { createMockTimeout } from '@tests/unit/shared/Stubs/TimeoutStub';
|
||||
|
||||
describe('TimeoutDelayScheduler', () => {
|
||||
describe('scheduleNext', () => {
|
||||
@@ -56,7 +57,8 @@ describe('TimeoutDelayScheduler', () => {
|
||||
expect(setTimeoutCalls.length).toBe(2);
|
||||
const clearTimeoutCalls = timerStub.callHistory.filter((c) => c.methodName === 'clearTimeout');
|
||||
expect(clearTimeoutCalls.length).toBe(1);
|
||||
const [actualId] = clearTimeoutCalls[0].args;
|
||||
const [timeout] = clearTimeoutCalls[0].args;
|
||||
const actualId = Number(timeout);
|
||||
expect(actualId).toBe(idOfFirstSetTimeoutCall);
|
||||
});
|
||||
});
|
||||
@@ -78,6 +80,7 @@ class TimeFunctionsStub
|
||||
methodName: 'setTimeout',
|
||||
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 { IEventSubscription } from '@/infrastructure/Events/IEventSource';
|
||||
import { getAbsentObjectTestCases, itEachAbsentObjectValue } from '@tests/unit/shared/TestCases/AbsentTests';
|
||||
import { createMockTimeout } from '@tests/unit/shared/Stubs/TimeoutStub';
|
||||
|
||||
describe('throttle', () => {
|
||||
describe('validates parameters', () => {
|
||||
@@ -153,7 +154,7 @@ class TimerMock implements ITimer {
|
||||
});
|
||||
this.subscriptions.push(subscription);
|
||||
const id = this.subscriptions.length - 1;
|
||||
return TimerMock.mockTimeout(id);
|
||||
return createMockTimeout(id);
|
||||
}
|
||||
|
||||
public clearTimeout(timeoutId: TimeoutType): void {
|
||||
@@ -172,15 +173,4 @@ class TimerMock implements ITimer {
|
||||
this.currentTime = ms;
|
||||
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