-
Notifications
You must be signed in to change notification settings - Fork 90
chore: delete jest, delete mocha, only use vitest #8952
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| "plugins": [ | ||
| "react-perf", | ||
| "css-modules", | ||
| "jest", |
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.
Removing jest configurations. We do not need jest.
| if (!tronApp) { | ||
| fail() | ||
| } | ||
| if (!tronApp) throw new Error('tronApp is missing.') |
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 not know how fail() was implemented before but it had to have been from jest or mocha global configurations.
I've oped to say throw an error if it is missing to crash the test.
| "@types/diff": "^7.0.2", | ||
| "@types/hammerjs": "^2.0.46", | ||
| "@types/isomorphic-fetch": "^0.0.39", | ||
| "@types/jest": "^30.0.0", |
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.
Removing all jest and mocha related packages.
| "vite/client", | ||
| "@types/wicg-file-system-access", | ||
| "node", | ||
| "mocha", |
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.
Removing mocha
| // as well as import your extension to test it | ||
| import * as vscode from 'vscode' | ||
|
|
||
| import { suite, test } from 'mocha' |
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.
Is importing from mocha intentional here?
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.
Yes otherwise the tsc will fail.
We have tsc on all *.ts files in the entire repository. Since I globally removed mocha from the tsconfig.json types this rust folder that has its own javascript library with another package.json needs this import.
This package under rust uses mocha which is different from ZDS's package.json and unit test library.
…ub.com:KittyCAD/modeling-app into nadro/adhoc/delete-jest-we-have-vitest-at-home
…ub.com:KittyCAD/modeling-app into nadro/adhoc/delete-jest-we-have-vitest-at-home
…ub.com:KittyCAD/modeling-app into nadro/adhoc/delete-jest-we-have-vitest-at-home
root causing
tsc passes because it thinks this is jest
tsc passes because it thinks this is jest
If you remove all
jestrelated stuff, it will then think itsmocha!even after removing
jestandmochait still thinks it isjestandmochaand not vitest :(issue
It looks like jest, mocha, and vitest are all configured in some way or imported and this is absurdly confusing.
implementation
vitest is probably globally importing
describe. When you check your lsp ortsccommand it says it is defined because we toldtsconfig.jsonthat we havemochainstalled. So the LSP andtsccheck were saying that all of ourdescribefunctions ortestfunctions aremochafunctions when it is not.Similar to jest. Jest had configurations and packages installed. This makes it so confusing.
https://github.com/KittyCAD/modeling-app/pull/8952/files#diff-b55cdbef4907b7045f32cc5360d48d262cca5f94062e353089f189f4460039e0L21
Since
vitestis most likely globally injecting all the functions our project configuration said we were usingjestandmochaso all the global imports that are not defined passtscbut for the wrong test runner.