Repository navigation
chore: jest -> vitest /editor - #492
Conversation
…est configurations, and remove unused Jest files
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis pull request migrates the editor package's test framework from Jest to Vitest. Changes include deleting Jest configuration, removing Jest-specific mocks and setup code, adding Vitest configuration, updating test scripts and dependencies in package.json, and adding explicit conditional exports to grida-canvas-cg's package.json. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
editor/grida-canvas/reducers/__tests__/vector-self-remove.test.ts (1)
38-38: Type assertion masks potentially missing required fields.The
satisfies Partial<...> as anypattern suggests the test node is missing required fields fromVectorNode. While acceptable for test scaffolding, consider adding the missing fields (e.g.,fill,stroke_width, etc.) to avoid potential runtime issues if the reducer starts validating node completeness.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
editor/grida-canvas-utils/css.test.tseditor/grida-canvas/reducers/__tests__/history.test.tseditor/grida-canvas/reducers/__tests__/image-paint-clipboard.test.tseditor/grida-canvas/reducers/__tests__/vector-cut.test.tseditor/grida-canvas/reducers/__tests__/vector-self-remove.test.tseditor/jest.config.jseditor/jest.setup.tseditor/package.jsoneditor/vitest.config.tspackages/grida-canvas-cg/package.json
💤 Files with no reviewable changes (5)
- editor/grida-canvas/reducers/tests/image-paint-clipboard.test.ts
- editor/grida-canvas-utils/css.test.ts
- editor/grida-canvas/reducers/tests/vector-cut.test.ts
- editor/jest.setup.ts
- editor/jest.config.js
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-12-01T00:22:41.045Z
Learnt from: CR
Repo: gridaco/grida PR: 0
File: editor/AGENTS.md:0-0
Timestamp: 2025-12-01T00:22:41.045Z
Learning: Applies to editor/**/next-env.d.ts : Include `next-env.d.ts` file in git for the project to avoid requiring dev/build runs for typechecking in CI environments
Applied to files:
editor/vitest.config.tseditor/package.json
📚 Learning: 2025-12-01T00:22:56.899Z
Learnt from: CR
Repo: gridaco/grida PR: 0
File: editor/app/(tools)/tools/halftone/AGENTS.md:0-0
Timestamp: 2025-12-01T00:22:56.899Z
Learning: Applies to editor/app/(tools)/tools/halftone/app/(tools)/tools/halftone/_page.tsx : For SVG export, convert circles to <circle> elements, rectangles to <rect> elements, and polygons to <polygon> elements with calculated points
Applied to files:
editor/grida-canvas/reducers/__tests__/vector-self-remove.test.ts
📚 Learning: 2025-12-01T00:22:56.899Z
Learnt from: CR
Repo: gridaco/grida PR: 0
File: editor/app/(tools)/tools/halftone/AGENTS.md:0-0
Timestamp: 2025-12-01T00:22:56.899Z
Learning: Applies to editor/app/(tools)/tools/halftone/app/(tools)/tools/halftone/_page.tsx : When adding new shape types, update the Shape type union, add cases in drawShape() function, add cases in shapeToSVG() function, and add SelectItem in UI
Applied to files:
editor/grida-canvas/reducers/__tests__/vector-self-remove.test.ts
📚 Learning: 2025-12-01T00:22:19.083Z
Learnt from: CR
Repo: gridaco/grida PR: 0
File: crates/grida-canvas-wasm/AGENTS.md:0-0
Timestamp: 2025-12-01T00:22:19.083Z
Learning: Applies to crates/grida-canvas-wasm/**/main.rs : Update `grida-canvas-wasm.d.ts` TypeScript definitions file when new APIs are introduced via `main.rs`
Applied to files:
packages/grida-canvas-cg/package.json
📚 Learning: 2025-12-01T00:22:19.083Z
Learnt from: CR
Repo: gridaco/grida PR: 0
File: crates/grida-canvas-wasm/AGENTS.md:0-0
Timestamp: 2025-12-01T00:22:19.083Z
Learning: Applies to crates/grida-canvas-wasm/**/+(grida-canvas-wasm.js|grida-canvas-wasm.wasm) : Include WASM artifacts (`grida-canvas-wasm.js` and `grida-canvas-wasm.wasm`) in git for faster CI builds
Applied to files:
packages/grida-canvas-cg/package.json
🧬 Code graph analysis (1)
editor/grida-canvas/reducers/__tests__/vector-self-remove.test.ts (1)
editor/grida-canvas/editor.ts (3)
state(331-333)state(2685-2687)state(3882-3884)
🔇 Additional comments (6)
packages/grida-canvas-cg/package.json (1)
25-31: LGTM!The conditional exports field is correctly structured with proper ordering (types → import → require) and aligns with the existing main/module/types fields. This ensures proper module resolution for both ESM and CJS consumers, which is particularly helpful for Vitest's module resolution.
editor/grida-canvas/reducers/__tests__/history.test.ts (2)
7-7: LGTM!The explicit import of
vifrom Vitest is a good practice even withglobals: true, as it provides better IDE support and makes the dependency clear.
278-287: Timing adjustment aligns with merge window logic.The change from 1200ms to 1401ms (401ms gap instead of 200ms) correctly tests that actions outside the 300ms merge window create separate history entries. The test now properly validates the boundary condition.
editor/grida-canvas/reducers/__tests__/vector-self-remove.test.ts (1)
53-63: State construction looks correct for the test scenario.The test properly initializes state via
editor.state.init()and adds test-specific overrides. Thegesture: { type: "idle" }andinitial_vector_networkadditions align with the expected state structure for content edit mode exit.editor/vitest.config.ts (1)
11-18: No changes needed to the vitest configuration.The test suite consists of unit tests (canvas operations, reducers, utilities, expressions) that do not interact with the DOM. Although
@testing-library/reactappears in devDependencies, it is not used in any test files. The default Node.js environment is appropriate for this project's testing needs.Likely an incorrect or invalid review comment.
editor/package.json (1)
12-12: No changes needed. The test scriptvitest runworks correctly—vitestis provided by the workspace root in this pnpm monorepo and is accessible to the editor package. The current setup is valid.
Tests
Chores