Port remaining test in module and context dir to vitest#3880
Conversation
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
e1d33c8 to
32c5e2d
Compare
7c11b07 to
ab7e80c
Compare
eemeli
left a comment
There was a problem hiding this comment.
Looks like we're nearly done with this! See inline for a few tweaks.
The getEmptyMessage test has been failing since before the transition. I’m currently looking into what needs to be done here.
This test suite works for me locally with both Jest and Vitest as-is. How is it failing for you, and what's your OS & Node.js version?
EntitiesList uses react-intersection-observer which has some ESM issue with vitest, and newer version which might solve this requires react^17.0.0 || ^18.0.0 || ^19.0.0"
Let's disable this test suite for now, and add a GitHub issue about it rather than trying to hack together a solution. Because of the enzyme dependency, we're stuck on React 16, which doesn't provide a package.json exports mapping that Vitest expects to resolve the import in the version of react-intersection-observer we're stuck on because, again, we're stuck on React 16.
I think the next PR in this sequence should let us drop Jest, make npm test run Vitest, and drop the test-ownership.js file, yes?
|
i am currently on node js v22.20.0 and mac OS 26.1. |
|
Yes, next Pr will totally drop the jest, test-ownership.js file and will configure vitest as our only test runner. Are we planning to drop sinon, currently the it's not causing any trouble but i think it would be great if we rely just on vitest which provides its mock tools and methods? |
eemeli
left a comment
There was a problem hiding this comment.
It looks like the getEmptyMessage test failure is a regression from #3874, as Node.js 22 and earlier don't sort the plural keys like I'd presumed. I'll submit a separate PR fixing my mistake there.
I am quite confused though by why this isn't getting classified as a CI failure, which it ought to do. But that's a separate matter from the changes here, which look good!
Yes, next Pr will totally drop the jest, test-ownership.js file and will configure vitest as our only test runner. i will create a github issue for EntitiesList with the jest removal PR such that the issue get documented.
Excellent!
Are we planning to drop sinon, currently the it's not causing any trouble but i think it would be great if we rely just on vitest which provides its mock tools and methods?
Yeah, it'd be good to drop Sinon once we can. Vitest mocking ought to be enough for us.
In continuation of the previous Mr #3877 for task #3768
This Mr includes porting of broken test to vitest under context and modules directory
moved useActiveTranslation test to separate file as the mock of react affected all the imports in EntityView.test.jsx, and i found no workaround to keep both test in same file.
Changed the test-ownership file to just ignore two test files in vitest and to be ran by jest
'src/utils/message/getEmptyMessage.test.js',
and
'src/modules/entitieslist/components/EntitiesList.test.js',
The getEmptyMessage test has been failing since before the transition. I’m currently looking into what needs to be done here. @eemeli , your guidance would be helpful.
EntitiesList uses react-intersection-observer which has some ESM issue with vitest, and newer version which might solve this requires react^17.0.0 || ^18.0.0 || ^19.0.0"