fix: decode Pest v4 php_qn:// evaluable format for describe(FQN::class) dataset tests#408
Merged
Merged
Conversation
3 tasks
…ncated suite names - PestV2Fixer: extend decodeEvaluable to handle → separator in describe block evaluable names (e.g. __pest_evaluable__something__→_it_should_detect_OK_but_does_not) - TestResultObserver: add prefix fallback for Pest v3 testSuiteStarted/Finished whose names are truncated due to mb_strrpos+substr byte/char mismatch; restricted to suite events only to avoid false positives
d2f7581 to
3d7ab62
Compare
…V3Fixer + ObserverFactory - Add PestV3Fixer.truncatedId() to compute v3-truncated ID aliases (2 bytes per → char) - ObserverFactory registers truncated aliases in testItemById at build time - TestResultObserver.find() simplified to exact lookup only — no version-specific logic
…ted ID aliases - TestItemByIdMap<T> extends Map, overrides set() to auto-register truncated aliases - ObserverFactory uses TestItemByIdMap instead of manual loop + PestV3Fixer call - TestResultObserver.test.ts uses TestItemByIdMap via buildTestItemById helper
- Rename TestItemByIdMap<T> → AliasMap<T>: name is framework-agnostic, shared by both PHPUnit and Pest, focuses on alias registration behavior - Remove PestV3Fixer from public API (index.ts); only AliasMap is exported - Remove unreachable ternary in PestV2Fixer.fixId (decodeEvaluable always returns a non-empty string)
- Remove PestV3Fixer object: truncatedId() was only used internally by AliasMap.set() in the same file; replace with a module-level private function - Remove PestV3Fixer re-export from PestFixer barrel (no external consumer) - Simplify decodeDescribePart: replace 17-line while-loop tokenizer with placeholder approach (__ → \0, split _, restore \0) - Merge double ternary on datasetIdx into a single destructure
- Extract decodeWords(): shared decode primitive used by both decodeDescribePart and the test-part decoding, removing duplication - Remove early return for segments.length < 2: the describe-less path is now handled by the unified single path (describeParts = []) - Remove `before` variable: always '' since hasPrefix() guarantees methodPart starts with PREFIX (prefixIdx === 0)
- Inline truncatedId() into AliasMap.set(): single-use private function with simple logic, inlining removes unnecessary indirection - Simplify part.replace(/^_/, '').replace(/_$/, '') to part.replace(/^_|_$/g, '')
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.
Summary
pest_qn://testfile.phptophp_qn://TestCaseFactory.php(eval'd code)::P\Tests\...\Class::__pest_evaluable__..., pointing to framework internals rather than the actual test filephp_qn://events withP\class prefix to Pest identifier, derive file path from classFQN, and decode__pest_evaluable__encoding with FQN heuristic fordescribe(FQN::class)blocks_= space/backtick/backslash,__= literal underscore,_→_separates describe segments; PascalCase heuristic detects FQN vs string describe namesChanges
TestIdentifierFactory: detect Pest v4php_qn://events viaP\class prefix patternPestTestIdentifier: handlephp_qn://by extracting classFQN and deriving file pathPestV2Fixer: adddecodeEvaluableV4()to decode nested describe paths with FQN heuristicClassConstantDatasetTest.phpfixture andPeNameenum for integration testingTest plan
pnpm -C packages/phpunit test -- --run(964/964)describe(PeName::class, ...)with->with([PeName::Standard, ...])shows correct test IDspest_qn://andfile://formats unaffected