Repository navigation
Consolidate redundant Data, Chunk.getUnsafe and Metric.track tests - #10280
Merged
Merged
Conversation
|
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
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.
Test-only cleanup in four
packages/effectsuites. No production code or runner config changes. The suite has 37 fewer tests (Data 38 → 22,Chunk.getUnsafe15 → 3, Metrictrack*12 → 3). Every assertion that was dropped is either kept in a merged test or duplicated something that is still checked.What changed
test/Data.test.ts(38 → 22 tests)name,age,Object.keysandReflect.ownKeysdeepStrictEqualon both variants)$is(3 tests)$match(3 tests)Math.PI * 25as the expected value, which restated the handler, so it now uses literal results.The declaration-emit test,
__proto__,.pipe(), no-arg constructors,toJSON, yieldable andcatchTagtests are unchanged.test/Chunk.test.ts,getUnsafe(15 → 3 tests)make(0,1,2)+append(3)/prepend(3)at index 1prependself.lengthbefore dispatching on the backing, andprependbuilds the same concat backing the concat property covers.test/Metric.test.ts,track*(12 → 3 tests)There were two
describe("track")blocks with identical bodies; one test was named "maps exits while preserving the instrumented effect result" but did not map exits. The second block is removed, andtrack,trackErrorsandtrackDefectsare now one table-driven test each that runs success, failure and defect against the same counter and asserts the running count ([1,2,3],[0,1,1],[0,0,1]). Each test uses the data-last form (self.pipe(Effect.track*(counter))), as the removed tests did, and asserts the three exits areExit.succeed(1),Exit.fail(1)andExit.die(1), so a combinator that changes the result of the effect it wraps still fails.test/Stream.test.tsThe
Stream.bufferdropping and sliding tests were filed under thebufferArray - dropping/bufferArray - slidingdescribes, which gave them the same names as thebufferArraytests. They now sit underbuffer - dropping/buffer - sliding. No test bodies changed.Regression check
I mutated production code temporarily and confirmed the consolidated tests fail:
Chunk.getUnsafebound<→<=: 1 failuregetUncheckedIArray returnsarray[0]: 4 failuresgetUncheckedIConcat skips the- left.lengthoffset: 1 failuretaggedEnumconstructor drops_tag: 4 failurestrackErrorsusestapCause(counts defects): 1 failuretrackDefectsdies after a successful effect (metric updates unchanged): 1 failuretrackDefectsdual always takes the data-first path, breaking the curried form: 1 failureTimings
Affected files only,
vitest run --project effect <files>, 3 runs each, median per-file wall time on an 8-core machine:Data.test.tsChunk.test.tsMetric.test.tsStream.test.tsOnly the Chunk drop is clearly real (one fewer fast-check property). The rest is within run-to-run noise:
Stream.test.tsbodies are unchanged, andData.test.tswall time is dominated by the declaration-emit test, which spawnstscfor about 4.5 s. This PR is about removing duplication, not suite speed.Checks
vitest runon the four files: passtsc -b tsconfig.tests.json: passoxlint,dprint checkon the changed files: passCloses EFF-3282