Skip to content

Commit

Permalink
chore: upgrade vitest to v2.0.0 (#3378)
Browse files Browse the repository at this point in the history
Migrated to Vitest 2.0 per https://vitest.dev/guide/migration.html

Changes:
- Updated vitest to ^2.0.0
- Added sequence.hooks configuration to maintain parallel hook execution
- All tests passing (887 passed, 6 skipped)
- Improved type annotations and fixed ts-expect-error comments

Link to Devin run:
https://app.devin.ai/sessions/ae55dd66b5024fa7bcdd130f3972e727

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Myles Scolnick <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and mscolnick authored Jan 8, 2025
1 parent 6fcde0a commit 4745b6d
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 320 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"typescript": "^5.7.2",
"vite": "^5.4.2",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"
"vitest": "^2.0.0"
},
"packageManager": "[email protected]",
"pnpm": {
Expand Down
445 changes: 132 additions & 313 deletions frontend/pnpm-lock.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ describe("RequestingTree", () => {
expect(result).toBe(true);
expect(sendListFiles).toHaveBeenCalledWith({ path: "/root/folder1" });
expect(mockOnChange).toHaveBeenCalled();
expect(mockOnChange.mock.calls.at(-1)[0]).toMatchInlineSnapshot(`
const lastCall = mockOnChange.mock.calls.at(-1);
expect(lastCall).toBeDefined();
expect(lastCall![0]).toMatchInlineSnapshot(`
[
{
"id": "1.1",
Expand Down Expand Up @@ -104,7 +106,9 @@ describe("RequestingTree", () => {
newPath: "/root/file2",
});
expect(mockOnChange).toHaveBeenCalled();
expect(mockOnChange.mock.calls.at(-1)[0]).toMatchInlineSnapshot(`
const lastCall = mockOnChange.mock.calls.at(-1);
expect(lastCall).toBeDefined();
expect(lastCall![0]).toMatchInlineSnapshot(`
[
{
"id": "1.1",
Expand Down Expand Up @@ -133,7 +137,9 @@ describe("RequestingTree", () => {
await requestingTree.move(["1.1"], "1.2");
expect(sendRenameFileOrFolder).toHaveBeenCalled();
expect(mockOnChange).toHaveBeenCalled();
expect(mockOnChange.mock.calls.at(-1)[0]).toMatchInlineSnapshot(`
const lastCall = mockOnChange.mock.calls.at(-1);
expect(lastCall).toBeDefined();
expect(lastCall![0]).toMatchInlineSnapshot(`
[
{
"id": "1.1",
Expand Down Expand Up @@ -183,7 +189,9 @@ describe("RequestingTree", () => {
await requestingTree.refreshAll(["1.1"]);
expect(sendListFiles).toHaveBeenCalled();
expect(mockOnChange).toHaveBeenCalled();
expect(mockOnChange.mock.calls.at(-1)[0]).toMatchInlineSnapshot(`
const lastCall = mockOnChange.mock.calls.at(-1);
expect(lastCall).toBeDefined();
expect(lastCall![0]).toMatchInlineSnapshot(`
[
{
"id": "1.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, it, expect, vi, beforeEach } from "vitest";
import type { EditorView } from "@codemirror/view";
import { makeBulkCommand, foldAllBulk, unfoldAllBulk } from "../commands";
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/plugins/impl/vega/__tests__/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ describe("DATE_MIDDLEWARE", () => {
const csv = "Date,Value\n2024-13-45,100\n2024-02-30,200";

// When parsing the CSV
const data = parseCsvData(csv, false) as { Date: string; Value: number }[];
const data = parseCsvData(csv, false) as Array<{
Date: string;
Value: number;
}>;

// Then invalid dates should remain as strings
expect(typeof data[0].Date).toBe("string");
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/plugins/layout/TexPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const importKatex = once(async () => {
});

const importMhChem = once(async () => {
// @ts-ignore : type is not exported by katex
// @ts-expect-error : type is not exported by katex
await import("katex/contrib/mhchem");
});

Expand Down
3 changes: 3 additions & 0 deletions frontend/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export default defineConfig({
environment: "jsdom",
include: ["src/**/*.test.ts", "src/**/*.test.tsx"],
setupFiles: ["src/__tests__/setup.ts"],
sequence: {
hooks: "parallel", // Maintain parallel hook execution from Vitest 1.x
},
},
plugins: [tsconfigPaths()],
});

0 comments on commit 4745b6d

Please sign in to comment.