-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update toolchain (Jest/Vitest/ViteJS/TS) #724
Open
11 of 13 tasks
Comments
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
Starting from https://vitest.dev/guide/ - this will replace jest as test runner.
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
An earlier prototype at least made `npm start` functional with this config, and we'd like to have the build pipeline (separate PR) use the same config as the tests.
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
* Ensure the test globals are injected (vitest doesn't do this by default) * Point to setup file to ensure jest matchers are registered (requires them to be registered as globals first)
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
Instead, the most elegant way to handle this is to use async/await syntax.
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
Instead, the most elegant way to handle this is to use async/await syntax.
sergei-maertens
added a commit
that referenced
this issue
Nov 17, 2024
When using relative imports, vite/vitest complain about ESM modules being used through a CJS package, and setting type: module in package.json breaks a lot of other things. Renaming the module to .mts pushes the problem down the chain. It seems that using the import alias seems to work to resolve the api-mocks package, but there are plenty of other problems...
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
Starting from https://vitest.dev/guide/ - this will replace jest as test runner.
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
An earlier prototype at least made `npm start` functional with this config, and we'd like to have the build pipeline (separate PR) use the same config as the tests.
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
* Ensure the test globals are injected (vitest doesn't do this by default) * Point to setup file to ensure jest matchers are registered (requires them to be registered as globals first)
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
Instead, the most elegant way to handle this is to use async/await syntax.
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
When using relative imports, vite/vitest complain about ESM modules being used through a CJS package, and setting type: module in package.json breaks a lot of other things. Renaming the module to .mts pushes the problem down the chain. It seems that using the import alias seems to work to resolve the api-mocks package, but there are plenty of other problems...
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
Set up a vite config and vitest configuration to transform our code and setup into something that compiles and passes the tests. Create React App is dead and the official React docs recommend using a framework like Next.js/Redux or a toolchain like Vite when building a low level library. We start with migrating the test suite to the Vite ecosystem before touching the bundler itself. This way we get most of the hiccups out of the way, while (hopefully) minimizing impact on actual production artifacts. Jest configuration has been removed from package.json. It's currently still used under the hood by storybook, but that too will be migrated in due time. We're sticking with jsdom for the time being - Vitest can run tests in a real browser, but it's still marked as experimental and we don't appear to be running into the same issues for MSW as we did with jest, which required a workaround by using a fixed jsdom environment.
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
These scripts/config files were necessary in a cra-jest setup, but are now obsolete when using vitest. 👋
sergei-maertens
added a commit
that referenced
this issue
Nov 26, 2024
* Replaced the jest mocks with vi mocks (which is the equivalent in vitest) * Replaced useFakeTimers with just mocking the system date/time, which is simpler in vitest. Note that using fake timers seems to have some challenges, but ultimately there shouldn't really be a need for that anymore. * Updated the stories to deal with the index.js -> index.jsx renames, which don't automatically resolve when doing directory imports * Rewrite more tests from legacy react test utils to testing-library/ react style tests, which are more pleasant to read and write and do encourage proper accessible queries
sergei-maertens
added a commit
that referenced
this issue
Nov 29, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 29, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 29, 2024
sergei-maertens
added a commit
that referenced
this issue
Nov 29, 2024
We can detect the environment based on the presence of 'process' or not, and adapt the reading of environment variables based on the detected environment. This means that we currently have to duplicate the configuration, but as long as this is a temporary measure, we should be fine.
sergei-maertens
added a commit
that referenced
this issue
Nov 29, 2024
require doesn't exist in Vite, but import.meta can be used instead.
sergei-maertens
added a commit
that referenced
this issue
Jan 1, 2025
Run a matrix of lint jobs so that we can run both prettier and ESLint together and consider the entire job as a dependency for other jobs.
sergei-maertens
added a commit
that referenced
this issue
Jan 3, 2025
Non-bundled code was not linted before when using the 'standard' CRA setup, and adding the explicit linting now to CI and npm scripts reveals quite a number of issues.
sergei-maertens
added a commit
that referenced
this issue
Jan 3, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 3, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 3, 2025
This includes the upgrade to prettier v3
sergei-maertens
added a commit
that referenced
this issue
Jan 3, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 3, 2025
eslint.config.mjs has precedence anyway.
sergei-maertens
added a commit
that referenced
this issue
Jan 4, 2025
eslint.config.mjs has precedence anyway.
sergei-maertens
added a commit
that referenced
this issue
Jan 4, 2025
…-eslint-config 🔥 [#724] Drop legacy eslint config in package.json
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
dist-vite is now dist, obsoleting the CRA build artifacts.
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
The 'scripts' directory is being removed with the removal of CRA.
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
start.js and build.js were the react-scripts entrypoints for CRA. They have been obsoleted by switching to Vite in the package.json scripts.
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
Utility/development scripts are now properly colocated in the bin/ folder, for consistency across projects/repositories.
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
Everything is replaced with Vite configuration.
Merged
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
These have been replaced with their VITE_* counterparts or are entirely obsoleted now.
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
sergei-maertens
added a commit
that referenced
this issue
Jan 6, 2025
And some other stuff that appears to not be used anymore.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Umbrella ticket for tasks and their order to update our toolchain to modern standards.
Short summary - CRA is dead and for us ViteJS looks very viable. We need to upgrade because at some point it won't be possible to upgrade Storybook etc. anymore or we'll be forced to work with deprecated APIs/tooling, which hurts development speed.
dist/
fordist-vite/
The text was updated successfully, but these errors were encountered: