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

Svelte 4, Vite 5, Jest->Vitest #427

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

microbit-matt-hillsdon
Copy link
Contributor

Although #407 suggested trying Jest/TS upgrades first, I think it's worth the relatively straightforward migration for the maintenance win over time from dropping the extra toolchain. It's at least worth you looking at the extent of the change to see if you're comfortable with it.

Type errors and other incompatibilities pushed me towards upgrading Vite/Svelte to get in a situation compatible with Vitest 1.x. The 3->4 Svelte migration seemed smooth sailing but it would be good for another set of eyes to review the app for unexpected changes.

There's one very minor visual change that I'll comment on inline, as I think it was a bug previously.

Closes #407

- Updates to eslint as required by other updates. There are many eslint
  errors on main before and after the change and it's not enforced by
  CI.
- Re-enable previously disabled tests.
"devDependencies": {
"@babel/preset-env": "^7.23.5",
"@bulatdashiev/svelte-slider": "^1.0.3",
"@smui/dialog": "^7.0.0-beta.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smui/dialog was entirely unused so I've just removed it

Copy link
Collaborator

Choose a reason for hiding this comment

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

Might have been an old import. Thank you for the thoroughness :)

@@ -204,7 +208,7 @@
<input
class="h-25 rotate-90 accent-primary"
type="range"
orient="vertical"
{...noTypeCheckNonStandardOrientProp('vertical')}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

orient is a non-standard prop that seems to have been removed from the type definitions so I've added a workaround

Copy link
Collaborator

Choose a reason for hiding this comment

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

This has been a pain for a while. It's a shame we have to make this workaround, but the support for vertical range inputs are sorely lacking, and I suspect at some point we will make our own vertical slider to overcome the issue. It will do for now :)

@@ -84,7 +84,7 @@
</p>
</div>
{:else}
<div cla54s="w-3/4 text-primarytext">
<div class="w-3/4 text-primarytext">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fix leads to a minor visual change as the width setting now takes effect. As the content is fairly narrow it only takes effect with a narrower window and seems like it was always intended.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Funny, nicely done :)

// browser mocks
const setLang = (lang: string) => {
const localStorageMock = (function () {
let store = {
isTesting: true,
lang: lang,
lang: JSON.stringify(lang),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a bug in the mocks that showed up in the test logs as they expected the language in local storage to be JSON stringified.

"devDependencies": {
"@babel/preset-env": "^7.23.5",
"@bulatdashiev/svelte-slider": "^1.0.3",
"@smui/dialog": "^7.0.0-beta.3",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might have been an old import. Thank you for the thoroughness :)

@@ -204,7 +208,7 @@
<input
class="h-25 rotate-90 accent-primary"
type="range"
orient="vertical"
{...noTypeCheckNonStandardOrientProp('vertical')}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This has been a pain for a while. It's a shame we have to make this workaround, but the support for vertical range inputs are sorely lacking, and I suspect at some point we will make our own vertical slider to overcome the issue. It will do for now :)

@@ -84,7 +84,7 @@
</p>
</div>
{:else}
<div cla54s="w-3/4 text-primarytext">
<div class="w-3/4 text-primarytext">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Funny, nicely done :)

@r59q
Copy link
Collaborator

r59q commented Dec 14, 2023

Great job, this is an amazing change

@r59q r59q merged commit 17b1e21 into microbit-foundation:main Dec 14, 2023
3 of 4 checks passed
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.

Swap from Jest to vitest
2 participants