You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to run mutation tests against my application, and it is frequently reporting untested methods which are definitely explicitly tested. If I attempt to make the same mutations to the original classes, my test suites will correctly catch the changes and fail, but pest simply reports the classes as untested:
UNTESTED src/Data/Frame.php > Line 21: EmptyStringToNotEmpty - ID: 202027099d87aea4
*/
readonly class Frame extends BaseData
{
- final public function __construct(public string $file = '', public string $class = '', public string $function = '', public int $line = 0, public object|null $object = null)
+ final public function __construct(public string $file = 'PEST Mutator was here!', public string $class = '', public string $function = '', public int $line = 0, public object|null $object = null)
{
//
}
This should be caught with this test which explicitly tests the "defaults" of a new class:
useRecursionGuard\Data\Frame;
covers(Frame::class);
it('makes a new frame that is empty', function () {
$frame = newFrame();
expect($frame->file)->toBe('')
->and($frame->class)->toBe('')
->and($frame->function)->toBe('')
->and($frame->line)->toBe(0)
->and($frame->object)->toBeNull()
->and($frame->empty())->toBeTrue();
});
And when I make the same modification to the Frame class, I (correctly) get a test failure:
FAILED Tests\Unit\Data\FrameTest > it makes a new frame that is empty
Failed asserting that two strings are identical.
-''
+'PEST Mutator was here!'
at tests/Unit/Data/FrameTest.php:14
10▕ it('makes a new frame that is empty', function () {
11▕ $frame = new Frame();
12▕
13▕ expect($frame->empty())->toBeTrue()
➜ 14▕ ->and($frame->file)->toBe('')
15▕ ->and($frame['file'])->toBe('')
16▕ ->and($frame->class)->toBe('')
17▕ ->and($frame['class'])->toBe('')
18▕ ->and($frame->function)->toBe('')
1 tests/Unit/Data/FrameTest.php:14
How to Reproduce
I'm not entirely sure how to force a reproduction here. It seems to happen on the same files each time, but not on others. There's no common theme that I can discover - some classes are abstract, some are readonly, some methods are final, but then there's another class right next to each one with the same properties that doesn't have the issue.
Code coverage doesn't seem to be an issue, either:
I noticed this in an earlier version of Pest, and mentioned it to @nunomaduro on twitter. At that time it was only reporting a handful of failures, but the latest version of pest seems to be giving me significantly higher numbers of failures.
The text was updated successfully, but these errors were encountered:
What Happened
I am attempting to run mutation tests against my application, and it is frequently reporting untested methods which are definitely explicitly tested. If I attempt to make the same mutations to the original classes, my test suites will correctly catch the changes and fail, but pest simply reports the classes as untested:
This should be caught with this test which explicitly tests the "defaults" of a new class:
And when I make the same modification to the Frame class, I (correctly) get a test failure:
With test results:
How to Reproduce
I'm not entirely sure how to force a reproduction here. It seems to happen on the same files each time, but not on others. There's no common theme that I can discover - some classes are
abstract
, some arereadonly
, some methods arefinal
, but then there's another class right next to each one with the same properties that doesn't have the issue.Code coverage doesn't seem to be an issue, either:
Sample Repository
No response
Pest Version
3.5.1
PHP Version
8.3.13
Operation System
Linux
Notes
I noticed this in an earlier version of Pest, and mentioned it to @nunomaduro on twitter. At that time it was only reporting a handful of failures, but the latest version of pest seems to be giving me significantly higher numbers of failures.
The text was updated successfully, but these errors were encountered: