Skip to content

Migrate to vitest - #963

Draft
Dreamsorcerer wants to merge 74 commits into
masterfrom
Dreamsorcerer-patch-1
Draft

Migrate to vitest#963
Dreamsorcerer wants to merge 74 commits into
masterfrom
Dreamsorcerer-patch-1

Conversation

@Dreamsorcerer

Copy link
Copy Markdown
Member

No description provided.

Comment thread admin-js/package.json Outdated
Comment on lines 37 to 39
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-fail-on-console": "3.3.1",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-fail-on-console": "3.3.1",

Comment thread admin-js/tests/setupTests.jsx Outdated
Comment thread admin-js/vite.config.js Outdated
Comment thread admin-js/tests/setupTests.jsx Outdated
@Dreamsorcerer Dreamsorcerer mentioned this pull request Aug 4, 2026
3 tasks
@Dreamsorcerer

Copy link
Copy Markdown
Member Author

@GeorgeHarland If you can check this one, that'd be really helpful. Lots of things still to fix here, but first issue is that the network requests to the app are failing.

Dreamsorcerer and others added 2 commits August 28, 2026 23:02
Co-authored-by: George H <georgeharland12@gmail.com>
@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown

Confidence Score: 3/5

The PR does not appear safe to merge because the migrated JavaScript suite still has unregistered DOM matchers and an export assertion against a non-mock function.

The current Vitest setup never registers the DOM matcher extensions used throughout the tests, and the disabled downloadCSV mock leaves the export test applying mock-only assertions to the real function.

Files Needing Attention: admin-js/tests/setupTests.jsx and admin-js/tests/simple.test.jsx

Reviews (2): Last reviewed commit: "Apply suggestion from @Dreamsorcerer" | Re-trigger Greptile

Comment on lines +4 to +6
//import failOnConsole from "jest-fail-on-console";
import {memoryStore} from "react-admin";
import {afterAll, beforeAll, beforeEach, expect} from "vitest";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 DOM matchers are unregistered

When the migrated tests evaluate toBeInTheDocument(), the setup no longer imports @testing-library/jest-dom, causing Vitest to reject the unknown matcher and fail the JavaScript test suite.

Comment on lines 20 to +26
jest.mock("react-admin", () => {
const originalModule = jest.requireActual("react-admin");
return {
...originalModule,
downloadCSV: jest.fn(), // Mock downloadCSV to test export button.
};
});
});*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Export mock is disabled

When the export test clicks the Export button, this disabled module mock leaves downloadCSV as the real function, so the subsequent toHaveBeenCalled() and toHaveBeenCalledWith() assertions operate on a non-mock and fail the test.

Comment thread admin-js/tests/setupTests.jsx Outdated
@Dreamsorcerer
Dreamsorcerer marked this pull request as draft August 28, 2026 22:19
Comment thread admin-js/tests/setupTests.jsx Outdated
Comment thread admin-js/tests/setupTests.jsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant