Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade vitest to v2.0.0 #3378

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()],
});
Loading