test: de-flake the jspm install-order vendor test (mock the live CDN) - #323
Merged
Conversation
The 'install order does not affect output' test hit ga.jspm.io twice and deepEqual'd the results, which flaked roughly 1 run in 4: the live CDN occasionally resolved a transitive dep in one ordering but not the other, so a green PR could fail CI for reasons unrelated to the change. The property under test is OUR per-package resolve + merge being order-independent, not the CDN's live transitive-resolution stability. Mock the generate endpoint so each install resolves to a fixed fragment, making the test deterministic with no network. Verified flake-free across repeated runs with network disabled. Closes #312
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.
Closes #312
Problem
packages/server/test/vendor/vendor.test.js'sjspmGenerate: install order does not affect outputhit the livega.jspm.ioCDN twice anddeepEquald the results. It flaked roughly 1 run in 4 across this session's PRs: the live CDN occasionally resolved a transitive dep in one ordering but not the other (observed:clsx's transitive), always passing on a plain re-run. A green PR could fail CI for a reason unrelated to the change, and the failure looked like a regression.Fix
The property under test is OUR per-package resolve + merge being order-independent, not the live CDN's transitive-resolution stability. Mock the
api.jspm.io/generateendpoint (via the file's existingwithMockedFetchhelper, duck-typed like the neighbouring failure-mode tests) so each install resolves to a fixed fragment. The test now assertsjspmGenerate([a, b])deep-equalsjspmGenerate([b, a])against deterministic fragments, with no network.Tests
WEBJS_SKIP_NETWORK_TESTS=1, proving no live dependency).Docs / dogfood: N/A (test-only change, no runtime or public-API surface).