Skip to content

Commit

Permalink
build(deps-dev): bump vitest and @vitest/coverage-v8 (#1349)
Browse files Browse the repository at this point in the history
* build(deps-dev): bump vitest and @vitest/coverage-v8

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) and [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8). These dependencies needed to be updated together.

Updates `vitest` from 1.6.0 to 2.0.1
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.0.1/packages/vitest)

Updates `@vitest/coverage-v8` from 1.6.0 to 2.0.1
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v2.0.1/packages/coverage-v8)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
  update-type: version-update:semver-major
- dependency-name: "@vitest/coverage-v8"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix: fix mock signatures

Signed-off-by: Jeff MAURY <[email protected]>

---------

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Jeff MAURY <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff MAURY <[email protected]>
  • Loading branch information
dependabot[bot] and jeffmaury authored Jul 9, 2024
1 parent ea8886f commit bebbacf
Show file tree
Hide file tree
Showing 10 changed files with 273 additions and 276 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/coverage-v8": "^2.0.1",
"autoprefixer": "^10.4.19",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
Expand All @@ -47,7 +47,7 @@
"svelte-check": "^3.8.4",
"typescript": "5.5.3",
"vite": "^5.3.3",
"vitest": "^1.6.0"
"vitest": "^2.0.1"
},
"workspaces": {
"packages": [
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@types/node": "^20",
"@types/postman-collection": "^3.5.10",
"@types/winreg": "^1.2.36",
"vitest": "^1.6.0",
"vitest": "^2.0.1",
"@types/mustache": "^4.2.5"
}
}
6 changes: 2 additions & 4 deletions packages/backend/src/managers/modelsManager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ function mockFiles(now: Date) {
info.mtime = now;
statSyncSpy.mockReturnValue(info);
const readdirSyncMock = vi.spyOn(fs, 'readdirSync') as unknown as MockInstance<
[path: string],
string[] | fs.Dirent[]
(path: string) => string[] | fs.Dirent[]
>;
readdirSyncMock.mockImplementation((dir: string) => {
if (dir.endsWith('model-id-1') || dir.endsWith('model-id-2')) {
Expand Down Expand Up @@ -300,8 +299,7 @@ test('getLocalModelsFromDisk should skip folders containing tmp files', async ()
});

const readdirSyncMock = vi.spyOn(fs, 'readdirSync') as unknown as MockInstance<
[path: string],
string[] | fs.Dirent[]
(path: string) => string[] | fs.Dirent[]
>;
readdirSyncMock.mockImplementation((dir: string) => {
if (dir.endsWith('model-id-1') || dir.endsWith('model-id-2')) {
Expand Down
12 changes: 8 additions & 4 deletions packages/backend/src/utils/downloader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { vi, test, expect, beforeEach } from 'vitest';
import { Downloader } from './downloader';
import { EventEmitter } from '@podman-desktop/api';
import { createWriteStream, promises, type WriteStream } from 'node:fs';
import https from 'node:https';
import type { IncomingMessage, ClientRequest } from 'node:http';
import https, { type RequestOptions } from 'node:https';
import type { ClientRequest, IncomingMessage } from 'node:http';

vi.mock('@podman-desktop/api', () => {
return {
Expand Down Expand Up @@ -75,7 +75,9 @@ test('perform download failed', async () => {
const downloader = new Downloader('dummyUrl', 'dummyTarget');

let onResponse: ((msg: IncomingMessage) => void) | undefined;
vi.mocked(https.get).mockImplementation((_url, _options, callback) => {
vi.mocked(
https.get as (url: string | URL, options: RequestOptions, callback: (_: IncomingMessage) => void) => ClientRequest,
).mockImplementation((_url, _options, callback) => {
onResponse = callback;
return {} as unknown as ClientRequest;
});
Expand Down Expand Up @@ -131,7 +133,9 @@ test('perform download failed', async () => {
test('perform download successfully', async () => {
const downloader = new Downloader('dummyUrl', 'dummyTarget');
let onResponse: ((msg: IncomingMessage) => void) | undefined;
vi.mocked(https.get).mockImplementation((_url, _options, callback) => {
vi.mocked(
https.get as (url: string | URL, options: RequestOptions, callback: (_: IncomingMessage) => void) => ClientRequest,
).mockImplementation((_url, _options, callback) => {
onResponse = callback;
return {} as unknown as ClientRequest;
});
Expand Down
8 changes: 4 additions & 4 deletions packages/backend/src/webviewUtils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { beforeEach, expect, test, vi } from 'vitest';
import { initWebview } from './webviewUtils';
import type { Uri } from '@podman-desktop/api';
import { promises } from 'node:fs';
import { type PathLike, promises } from 'node:fs';

vi.mock('@podman-desktop/api', async () => {
return {
Expand Down Expand Up @@ -51,7 +51,7 @@ beforeEach(() => {
});

test('panel should have file content as html', async () => {
vi.mocked(promises.readFile).mockImplementation(() => {
vi.mocked(promises.readFile as (path: PathLike) => Promise<string>).mockImplementation(() => {
return Promise.resolve('<html></html>');
});

Expand All @@ -60,7 +60,7 @@ test('panel should have file content as html', async () => {
});

test('script src should be replaced with asWebviewUri result', async () => {
vi.mocked(promises.readFile).mockImplementation(() => {
vi.mocked(promises.readFile as (path: PathLike) => Promise<string>).mockImplementation(() => {
return Promise.resolve('<script type="module" crossorigin src="./index-RKnfBG18.js"></script>');
});

Expand All @@ -69,7 +69,7 @@ test('script src should be replaced with asWebviewUri result', async () => {
});

test('links src should be replaced with asWebviewUri result', async () => {
vi.mocked(promises.readFile).mockImplementation(() => {
vi.mocked(promises.readFile as (path: PathLike) => Promise<string>).mockImplementation(() => {
return Promise.resolve('<link rel="stylesheet" href="./styles.css">');
});

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
"svelte-markdown": "^0.4.1",
"svelte-preprocess": "^6.0.1",
"tailwindcss": "^3.4.4",
"vitest": "^1.6.0"
"vitest": "^2.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const mocks = vi.hoisted(() => ({
requestRemoveLocalModel: vi.fn(),
openFile: vi.fn(),
downloadModel: vi.fn(),
getInferenceServersMock: vi.fn<void[], InferenceServer[]>(),
getInferenceServersMock: vi.fn<() => InferenceServer[]>(),
}));

vi.mock('/@/utils/client', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { type InferenceServer, InferenceType } from '@shared/src/models/IInferen

const mocks = vi.hoisted(() => {
return {
getInferenceServersMock: vi.fn<void[], InferenceServer[]>(),
getInferenceServersMock: vi.fn<() => InferenceServer[]>(),
};
});

Expand Down
2 changes: 1 addition & 1 deletion tests/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@types/node": "^20",
"electron": "^31.1.0",
"typescript": "^5.5.3",
"vitest": "^1.6.0",
"vitest": "^2.0.1",
"xvfb-maybe": "^0.2.1"
}
}
Loading

0 comments on commit bebbacf

Please sign in to comment.