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

Cb 6265 Return front unit tests after migration #3338

Open
wants to merge 12 commits into
base: devel
Choose a base branch
from

Conversation

sergeyteleshev
Copy link
Contributor

No description provided.

SychevAndrey
SychevAndrey previously approved these changes Mar 25, 2025
Copy link
Contributor

@SychevAndrey SychevAndrey left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏻

* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
/// <reference types="vitest/config" />
Copy link
Member

Choose a reason for hiding this comment

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

do we really need this reference?

Comment on lines 16 to 23
include: [
// unix
'packages/*/lib/**/*.{spec,test}.{js,jsx}',
'lib/**/*.{spec,test}.{js,jsx}',
// windows
'packages\\*\\lib\\**\\*.{spec,test}.{js,jsx}',
'lib\\**\\*.{spec,test}.{js,jsx}',
],
Copy link
Member

Choose a reason for hiding this comment

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

probably, we can use include: ["**/lib/**/*.test.js"],
(it also should be universal and work for Windows too, I think that's handled by vitest itself)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From previous experience with the Vite assets plugin this worked out. I'll check that on Windows also

Comment on lines 25 to 34
alias: [
{
find: /.*.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)%/,
replacement: path.resolve(__dirname, './__mocks__/fileMock.js'),
},
{
find: /.*.(css|scss|less)$/,
replacement: path.resolve(__dirname, './__mocks__/styleMock.js'),
},
],
Copy link
Member

Choose a reason for hiding this comment

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

this handled by vitest itself and can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can safely remove mapping to the files, but not for CSS files cause it leads to the error

Removed the first alias then

Screenshot 2025-03-26 at 18 10 20

replacement: path.resolve(__dirname, './__mocks__/styleMock.js'),
},
],
globals: true,
Copy link
Member

Choose a reason for hiding this comment

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

please remove (we want to use default's global:false)

*/
import { expect } from 'vitest';
import * as matchers from 'jest-extended';
import '@testing-library/jest-dom';
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines 79 to 81
if (isTestFile) {
devDependencies.add('@types/jest');
devDependencies.add('vitest');
}
Copy link
Member

Choose a reason for hiding this comment

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

i think it will be added by default because we will use import from vitest so we probably can remove it

*
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { beforeEach, describe, expect, jest, test } from '@jest/globals';
import { beforeEach, describe, expect, vitest, test } from 'vitest';
Copy link
Member

Choose a reason for hiding this comment

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

why not vi instead of vitest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

idk, just did it. its the same

* you may not use this file except in compliance with the License.
*/
/// <reference types="@testing-library/jest-dom" />
export * from '@testing-library/jest-dom';
Copy link
Member

Choose a reason for hiding this comment

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

we should avoid using globals (this will mess up with all TS files)

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.

3 participants