-
Notifications
You must be signed in to change notification settings - Fork 416
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
base: devel
Are you sure you want to change the base?
Cb 6265 Return front unit tests after migration #3338
Conversation
There was a problem hiding this 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" /> |
There was a problem hiding this comment.
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?
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}', | ||
], |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
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'), | ||
}, | ||
], |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replacement: path.resolve(__dirname, './__mocks__/styleMock.js'), | ||
}, | ||
], | ||
globals: true, |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (isTestFile) { | ||
devDependencies.add('@types/jest'); | ||
devDependencies.add('vitest'); | ||
} |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
webapp/packages/tsconfig/test.d.ts
Outdated
* you may not use this file except in compliance with the License. | ||
*/ | ||
/// <reference types="@testing-library/jest-dom" /> | ||
export * from '@testing-library/jest-dom'; |
There was a problem hiding this comment.
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)
No description provided.