-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
[test] Use vite and vitest for e2e and regression tests #1127
Conversation
Netlify deploy preview |
f21bd83
to
c14ce9e
Compare
1b7ee44
to
76d77af
Compare
61a95b6
to
35cd7ff
Compare
"test:jsdom": "cross-env NODE_ENV=test VITEST_ENV=jsdom vitest", | ||
"test:chromium": "cross-env NODE_ENV=test VITEST_ENV=chromium vitest", | ||
"test:firefox": "cross-env NODE_ENV=test VITEST_ENV=firefox vitest", | ||
"test:jsdom": "cross-env NODE_ENV=test VITEST_ENV=jsdom vitest --project @base-ui-components/react --project docs", |
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.
These all need to be filtered with --project
now that test
also includes Vitest workspaces
I noticed that tests in docs
weren't being run at all before explicitly specifying the project flag
c8868eb
to
3298810
Compare
f3cf49a
to
d721946
Compare
d721946
to
5777772
Compare
5777772
to
2442ef5
Compare
const [fontState, setFontState] = React.useState('pending'); | ||
React.useEffect(() => { | ||
webfontloader.load({ | ||
custom: { | ||
families: ['Unica 77'], | ||
urls: ['../../docs/src/styles.css'], | ||
}, | ||
timeout: 20000, | ||
active: () => { | ||
setFontState('active'); | ||
}, | ||
inactive: () => { | ||
setFontState('inactive'); | ||
}, | ||
}); | ||
}, []); |
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 don't need this as we are not loading webfonts, and the inner TestViewer
already waits for font load events
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.
It looks ok to me, everything seem to work as expected, but I would wait for @michaldudak for a final review before merging. I don't expect lot of conflicts, so it would probably be ok sitting for few weeks.
.eslintrc.js
Outdated
files: ['test/**/*{.ts,.tsx}'], | ||
rules: { | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'import/no-relative-packages': 'off', |
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 switching this off?
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.
Thought it was needed to import the shared vitest config but it's not!
71c89d0
to
77ce77f
Compare
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'm having issues running these tests on Windows - no tests are detected. I suspect this could be related to path separators in globbedRegressionFixtures(test/regressions/main.tsx)
@michaldudak When you run ( |
I managed to fix the Windows issue. There are a couple of warnings on the console when running tests:
We can hide it by increasing the
I believe the Vite config file must be an ESM module. |
d9131b8
to
ccd9290
Compare
ccd9290
to
411fbad
Compare
Thanks ~ @michaldudak The console warnings are fixed: https://app.circleci.com/pipelines/github/mui/base-ui/6840/workflows/02371255-ba7b-46e5-9d9f-9155ff899ed7/jobs/59536/parallel-runs/0/steps/0-106 I've also moved the vite config to a shared config as they are identical |
.eslintignore
Outdated
@@ -7,5 +7,6 @@ | |||
/packages/react/**/*.min.* | |||
build | |||
build-tests | |||
dist |
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.
nit: could this directory be named build
to be consistent with the rest of the codebase?
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.
Updated! (dist
was just the vite default)
c08c6f2
to
d0bf4b1
Compare
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!
Co-authored-by: Michał Dudak <[email protected]>
webfontloader
(and some font loading code) is no longer needed as we are loading local font filesPart of #883