Skip to content

Commit d3ba52d

Browse files
chore(deps): update dependency vitest to v4 [security] (#443)
* chore(deps): update dependency vitest to v4 [security] * fix(deps): co-bump @vitest/coverage-v8 and @vitest/ui to v4.1.0 * fix(vitest4): migrate tests and configs for vitest 4 compatibility * fixup! fix(deps): co-bump @vitest/coverage-v8 and @vitest/ui to v4.1.0 * fixup! fix(vitest4): migrate tests and configs for vitest 4 compatibility --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Elliott de Launay <edelauna@gmail.com>
1 parent 6bcd398 commit d3ba52d

186 files changed

Lines changed: 2274 additions & 2036 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
"@roo-code/config-typescript": "workspace:^",
4444
"@types/node": "24.2.1",
4545
"@types/react": "18.3.23",
46-
"@vitest/coverage-v8": "3.2.6",
46+
"@vitest/coverage-v8": "4.1.0",
4747
"ink-testing-library": "4.0.0",
4848
"rimraf": "6.0.1",
4949
"tsup": "8.5.0",
5050
"tsx": "4.19.4",
51-
"vitest": "3.2.6"
51+
"vitest": "4.1.0"
5252
}
5353
}

apps/cli/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"extends": "@roo-code/config-typescript/base.json",
33
"compilerOptions": {
4-
"types": ["vitest/globals"],
54
"outDir": "dist",
65
"jsx": "react-jsx",
76
"jsxImportSource": "react",

apps/cli/vitest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineConfig({
1616
coverage: {
1717
provider: "v8",
1818
reporter: ["text", "lcov"],
19+
include: ["src/**/*.ts", "src/**/*.tsx"],
1920
exclude: ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx", "**/vitest.config.ts"],
2021
},
2122
},

apps/vscode-e2e/tsconfig.esm.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"extends": "@roo-code/config-typescript/base.json",
33
"compilerOptions": {
4-
"outDir": "out"
4+
"outDir": "out",
5+
"types": ["node"]
56
},
67
"include": ["src"],
78
"exclude": ["node_modules"]

packages/build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
"@roo-code/config-eslint": "workspace:^",
2020
"@roo-code/config-typescript": "workspace:^",
2121
"@types/node": "20.19.41",
22-
"vitest": "3.2.6"
22+
"vitest": "4.1.0"
2323
}
2424
}

packages/build/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"extends": "@roo-code/config-typescript/base.json",
33
"compilerOptions": {
4-
"types": ["vitest/globals"],
54
"outDir": "dist"
65
},
76
"include": ["src"],

packages/cloud/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@types/node": "24.2.1",
2525
"@types/vscode": "1.100.0",
2626
"globals": "16.3.0",
27-
"@vitest/coverage-v8": "3.2.6",
28-
"vitest": "3.2.6"
27+
"@vitest/coverage-v8": "4.1.0",
28+
"vitest": "4.1.0"
2929
}
3030
}

packages/cloud/src/__mocks__/vscode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22

3-
export const window = {
3+
export const window: { showInformationMessage: (...args: any[]) => any; showErrorMessage: (...args: any[]) => any } = {
44
showInformationMessage: vi.fn(),
55
showErrorMessage: vi.fn(),
66
}
77

8-
export const env = {
8+
export const env: { openExternal: (...args: any[]) => any } = {
99
openExternal: vi.fn(),
1010
}
1111

1212
export const Uri = {
1313
parse: vi.fn((uri: string) => ({ toString: () => uri })),
1414
}
1515

16-
export const commands = {
16+
export const commands: { executeCommand: (...args: any[]) => any } = {
1717
executeCommand: vi.fn().mockResolvedValue(undefined),
1818
}
1919

packages/cloud/src/__tests__/CloudService.test.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,21 @@ describe("CloudService", () => {
147147
backfillMessages: vi.fn().mockResolvedValue(undefined),
148148
}
149149

150-
vi.mocked(WebAuthService).mockImplementation(() => mockAuthService as unknown as WebAuthService)
150+
vi.mocked(WebAuthService).mockImplementation(function () {
151+
return mockAuthService as unknown as WebAuthService
152+
})
151153

152-
vi.mocked(CloudSettingsService).mockImplementation(() => mockSettingsService as unknown as CloudSettingsService)
154+
vi.mocked(CloudSettingsService).mockImplementation(function () {
155+
return mockSettingsService as unknown as CloudSettingsService
156+
})
153157

154-
vi.mocked(CloudShareService).mockImplementation(() => mockShareService as unknown as CloudShareService)
158+
vi.mocked(CloudShareService).mockImplementation(function () {
159+
return mockShareService as unknown as CloudShareService
160+
})
155161

156-
vi.mocked(TelemetryClient).mockImplementation(() => mockTelemetryClient as unknown as TelemetryClient)
162+
vi.mocked(TelemetryClient).mockImplementation(function () {
163+
return mockTelemetryClient as unknown as TelemetryClient
164+
})
157165
})
158166

159167
afterEach(() => {
@@ -417,7 +425,9 @@ describe("CloudService", () => {
417425
})
418426

419427
// Override the mock to return our properly typed instance
420-
vi.mocked(CloudSettingsService).mockImplementation(() => mockCloudSettingsService)
428+
vi.mocked(CloudSettingsService).mockImplementation(function () {
429+
return mockCloudSettingsService
430+
})
421431

422432
const cloudService = await CloudService.createInstance(mockContext)
423433

@@ -450,9 +460,9 @@ describe("CloudService", () => {
450460
}
451461

452462
// Override the mock to return a service that won't pass instanceof check
453-
vi.mocked(CloudSettingsService).mockImplementation(
454-
() => mockStaticSettingsService as unknown as CloudSettingsService,
455-
)
463+
vi.mocked(CloudSettingsService).mockImplementation(function () {
464+
return mockStaticSettingsService as unknown as CloudSettingsService
465+
})
456466

457467
// This should not throw even though the service doesn't pass instanceof check
458468
const _cloudService = await CloudService.createInstance(mockContext)

packages/cloud/src/__tests__/CloudSettingsService.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ vi.mock("../config", () => ({
1111
getRooCodeApiUrl: vi.fn().mockReturnValue("https://app.roocode.com"),
1212
}))
1313

14-
global.fetch = vi.fn()
14+
global.fetch = vi.fn() as unknown as typeof fetch
1515

1616
describe("CloudSettingsService", () => {
1717
let mockContext: ExtensionContext
@@ -27,7 +27,7 @@ describe("CloudSettingsService", () => {
2727
stop: ReturnType<typeof vi.fn>
2828
}
2929
let cloudSettingsService: CloudSettingsService
30-
let mockLog: ReturnType<typeof vi.fn>
30+
let mockLog: (...args: unknown[]) => void
3131

3232
const mockSettings: OrganizationSettings = {
3333
version: 1,
@@ -75,7 +75,9 @@ describe("CloudSettingsService", () => {
7575
mockLog = vi.fn()
7676

7777
// Mock RefreshTimer constructor
78-
vi.mocked(RefreshTimer).mockImplementation(() => mockRefreshTimer as unknown as RefreshTimer)
78+
vi.mocked(RefreshTimer).mockImplementation(function () {
79+
return mockRefreshTimer as unknown as RefreshTimer
80+
})
7981

8082
cloudSettingsService = new CloudSettingsService(mockContext, mockAuthService as unknown as AuthService, mockLog)
8183
})

0 commit comments

Comments
 (0)