test: Add fast-check and vitest config infrastructure#30
Open
NAME-ASHWANIYADAV wants to merge 1 commit into
Open
test: Add fast-check and vitest config infrastructure#30NAME-ASHWANIYADAV wants to merge 1 commit into
NAME-ASHWANIYADAV wants to merge 1 commit into
Conversation
12 tasks
Contributor
Author
|
@illume will appreciate a review !! |
Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
4d94e7b to
cf39ab9
Compare
lacroixthomas
left a comment
Contributor
There was a problem hiding this comment.
LGTM !
About the mock, we can still add things to it depending on the usage with other PRs 👌🏼
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
What this PR does
This PR introduces the testing infrastructure required for property-based testing in the Agones plugin.
The Agones plugin resource models (GameServer, Fleet, etc.) extend
KubeObjectfrom@kinvolk/headlamp-plugin/lib/k8s/cluster. This path is externalised by Headlamp at build time and does not physically exist innode_modules, causing Vitest to crash when trying to instantiate these models in tests.To fix this, this PR:
fast-checkas a devDependency.src/__mocks__/kubeObject.tsas a minimal stand-inKubeObject.vitest.config.mtswhich extends the upstream Headlamp vite config with a resolve alias, redirecting the externalised import to our mock.testscript inpackage.jsonto use this custom vitest config.This is a pure infrastructure PR. The actual property-based tests will follow in a subsequent PR.
Test plan
Automated checks
npm cinpm run buildnpm run tscnpm run lintnpm run format -- --checknpm run testVerified that the mock only affects the test environment and
npm run buildbehaves exactly as before.Notes for reviewers
This infrastructure matches the standard approach for testing Headlamp plugins that extend
KubeObject. It does not conflict with pending PRs since the new config and mock files are completely new.