-
Notifications
You must be signed in to change notification settings - Fork 89
chore: proper integration testing no funny business, no lying, no global foot gunning #8511
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
.github/workflows/unit-tests.yml
Outdated
|
||
- name: Install Chromium Browser | ||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }} | ||
run: npm run playwright install chromium --with-deps |
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.
Just checking, do the integration tests still need a real web browser?
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 do not think so? https://vitest.dev/guide/browser/
I am trying to see if it is possible to configure a browser with vitest. I honestly do not think we have this integration enabled. I checked the vitest.config.ts
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.
Yeah, seems like we don't need the browser. For review to merge into this branch: #8622
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.
Actually, I changed my mind and marked that as a draft based on this conversation. Ideally, the npm-test-unit
job doesn't need Wasm at all.
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.
Correct. The proper way to solve this would be dependency injection and not directly importing WASM functions from that binding.
Our application today does not do dependency injection so the dependency must exist for the unit test to import even if my unit test is not directly using it. The import/export builder step will crash.
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.
Great work on this!
…hub.com:KittyCAD/modeling-app into nadro/gh-8377/wasm-instance-in-integration-test
closes #8377
Issue
I made a massive integration.spec.ts because the engine connection code and WASM loaders were not stable with multiple files spamming
initPromise()
Implementation
unitTestUtils.ts
implementsbuildTheWorldAndConnectToEngine
andbuildTheWorldAndNoEngineConnection
it(
test can build the world and doengineCommandManager.tearDown()
initPromise()
spam will have aPromise.resolve()
but say it failed so all of the tests will brick unless you build the worldEven though an entire
.spec.ts
file can have eachit(
test build the world with engine connection and destroy it that is super resource intensive so a single file will do this at the start and destroy at the end. This is not the same as using global singletons imports. Everything is still created locally within that file and passed to all theit(
tests.Tests that do not use the engine connection will build the world each
it(
since it is all based on memory usage not the remote engine connection.Each test that needs only a WASM instance will build it again since you read off disk and then store an instance of it in memory.
All *.spec.ts(x) files are migrated
npx vitest run --mode development --no-file-parallelism --project integration
will run all the tests with 1 file at a time.Massive
wasmInstance?: ModuleType
spammed in every helper functionhuge update to the modelingMachine to use the
context
and the provided ones over the global ones