Compare commits

...

27 Commits

Author SHA1 Message Date
78d9fd31d0 release: v2.34.1 2024-02-28 15:15:55 +00:00
602b696348 release: v2.34.0 2024-02-17 10:06:53 +00:00
5b0f88c227 release: v2.33.6 2024-02-12 08:55:32 +00:00
f31a2c3220 chore: fixes paratest 2024-02-12 08:53:04 +00:00
e8fa98c810 release: 2.33.5 2024-02-12 08:44:52 +00:00
07e314fbf5 chore: bumps dependencies 2024-02-12 08:44:40 +00:00
4baf27911e release: 2.33.4 2024-02-02 16:54:54 +00:00
12e48a14d1 chore: fixes deps 2024-02-02 16:53:58 +00:00
1bc0f79508 release: 2.33.3 2024-02-02 16:51:42 +00:00
cb0f256791 release: 2.33.2 2024-02-02 16:50:40 +00:00
923970a117 chore: bumps versioning 2024-02-01 11:51:11 +00:00
b3db7dfd4c chore: fixes type checking 2024-02-01 11:45:19 +00:00
b303f9f818 Merge pull request #1082 from nhaynes/fix-ci-flag
fix: updates Only plugin to check for CI environment
2024-01-30 14:17:03 +00:00
d29997d5b0 fix: updates Only plugin to check for CI environment 2024-01-29 19:03:06 -06:00
13f340a742 feat: improves badge coloring 2024-01-29 23:00:30 +00:00
eeade88ad2 Fixes kernel throwing all kind of errors 2024-01-29 12:50:00 +00:00
06280ef75d chore: updates snaphosts 2024-01-29 11:54:23 +00:00
aa46f73888 Merge pull request #1081 from nuernbergerA/track-vendor-changes
[2.x] Track vendor changes
2024-01-29 11:39:34 +00:00
3660865e5e update snapshot 2024-01-29 08:58:07 +01:00
13695d597b Merge branch '2.x' into track-vendor-changes 2024-01-29 08:56:41 +01:00
fab2de833f Merge pull request #1080 from nuernbergerA/test-junit
[2.x] Add test for junit implementation
2024-01-28 23:49:06 +00:00
5b630bcdff possible implementation 2024-01-28 09:48:37 +01:00
e70edbfa38 normalize path for windows 2024-01-28 09:11:06 +01:00
b1558ddde5 update snapshot 2024-01-28 09:04:42 +01:00
582529377b add test for junit output 2024-01-28 08:53:20 +01:00
88714598b6 Merge pull request #1076 from pestphp/fixing-version
[2.x] Fixing Version `2.33` for New Release
2024-01-27 13:01:06 +00:00
AJ
5136267bbe fixing version for new release 2024-01-26 23:43:52 -03:00
15 changed files with 141 additions and 20 deletions

View File

@ -81,6 +81,7 @@ $bootPest = (static function (): void {
$getopt['teamcity-file'] ?? null, $getopt['teamcity-file'] ?? null,
$getopt['testdox-file'] ?? null, $getopt['testdox-file'] ?? null,
isset($getopt['testdox-color']), isset($getopt['testdox-color']),
$getopt['testdox-columns'] ?? null,
); );
while (true) { while (true) {

View File

@ -22,11 +22,11 @@
"nunomaduro/collision": "^7.10.0|^8.1.0", "nunomaduro/collision": "^7.10.0|^8.1.0",
"nunomaduro/termwind": "^1.15.1|^2.0.0", "nunomaduro/termwind": "^1.15.1|^2.0.0",
"pestphp/pest-plugin": "^2.1.1", "pestphp/pest-plugin": "^2.1.1",
"pestphp/pest-plugin-arch": "^2.6.1", "pestphp/pest-plugin-arch": "^2.7.0",
"phpunit/phpunit": "^10.5.9" "phpunit/phpunit": "^10.5.11"
}, },
"conflict": { "conflict": {
"phpunit/phpunit": ">10.5.9", "phpunit/phpunit": ">10.5.11",
"sebastian/exporter": "<5.1.0", "sebastian/exporter": "<5.1.0",
"webmozart/assert": "<1.11.0" "webmozart/assert": "<1.11.0"
}, },
@ -53,7 +53,7 @@
"require-dev": { "require-dev": {
"pestphp/pest-dev-tools": "^2.16.0", "pestphp/pest-dev-tools": "^2.16.0",
"pestphp/pest-plugin-type-coverage": "^2.8.0", "pestphp/pest-plugin-type-coverage": "^2.8.0",
"symfony/process": "^6.4.0|^7.0.2" "symfony/process": "^6.4.0|^7.0.4"
}, },
"minimum-stability": "dev", "minimum-stability": "dev",
"prefer-stable": true, "prefer-stable": true,

View File

@ -10,7 +10,7 @@
?> ?>
<div class="my-1"> <div class="my-1">
<span class="ml-2 px-1 bg-<?php echo $bgBadgeColor ?>-600 font-bold"><?php echo htmlspecialchars($bgBadgeText) ?></span> <span class="ml-2 px-1 bg-<?php echo $bgBadgeColor ?> font-bold"><?php echo htmlspecialchars($bgBadgeText) ?></span>
<span class="ml-1"> <span class="ml-1">
<?php echo htmlspecialchars($content) ?> <?php echo htmlspecialchars($content) ?>
</span> </span>

View File

@ -15,17 +15,17 @@ final class BootOverrides implements Bootstrapper
/** /**
* The list of files to be overridden. * The list of files to be overridden.
* *
* @var array<int, string> * @var array<string, string>
*/ */
private const FILES = [ public const FILES = [
'Runner/Filter/NameFilterIterator.php', 'c7b9c8a96006dea314204a8f09a8764e51ce0b9b79aadd58da52e8c328db4870' => 'Runner/Filter/NameFilterIterator.php',
'Runner/ResultCache/DefaultResultCache.php', '52b2574e96269aca1bb2d41bbf418c3bcf23dd21d14c66f90789025c309e39df' => 'Runner/ResultCache/DefaultResultCache.php',
'Runner/TestSuiteLoader.php', 'bc8718c89264f65800beabc23e51c6d3bcff87dfc764a12179ef5dbfde272c8b' => 'Runner/TestSuiteLoader.php',
'TextUI/Command/WarmCodeCoverageCacheCommand.php', 'f41e48d6cb546772a7de4f8e66b6b7ce894a5318d063eb52e354d206e96c701c' => 'TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php',
'TextUI/Output/Default/ProgressPrinter/TestSkippedSubscriber.php', 'cb7519f2d82893640b694492cf7ec9528da80773cc1d259634181b5d393528b5' => 'TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php',
'TextUI/TestSuiteFilterProcessor.php', '6db25ee539e9b12b1fb4e044a0a93410e015bc983ecdd3909cd394fe44ae8c95' => 'TextUI/TestSuiteFilterProcessor.php',
'Event/Value/ThrowableBuilder.php', 'ef64a657ed9c0067791483784944107827bf227c7e3200f212b6751876b99e25' => 'Event/Value/ThrowableBuilder.php',
'Logging/JUnit/JunitXmlLogger.php', 'c78f96e34b98ed01dd8106539d59b8aa8d67f733274118b827c01c5c4111c033' => 'Logging/JUnit/JunitXmlLogger.php',
]; ];
/** /**

View File

@ -139,6 +139,10 @@ final class Kernel
$this->terminate(); $this->terminate();
if (is_array($error = error_get_last())) { if (is_array($error = error_get_last())) {
if (! in_array($error['type'], [E_ERROR, E_CORE_ERROR], true)) {
return;
}
$message = $error['message']; $message = $error['message'];
$file = $error['file']; $file = $error['file'];
$line = $error['line']; $line = $error['line'];

View File

@ -6,7 +6,7 @@ namespace Pest;
function version(): string function version(): string
{ {
return '2.32.2'; return '2.34.1';
} }
function testDirectory(string $file = ''): string function testDirectory(string $file = ''): string

View File

@ -40,6 +40,10 @@ final class Only implements Terminable
*/ */
public static function enable(TestCall $testCall): void public static function enable(TestCall $testCall): void
{ {
if (Environment::name() == Environment::CI) {
return;
}
$testCall->group('__pest_only'); $testCall->group('__pest_only');
$lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock'; $lockFile = self::TEMPORARY_FOLDER.DIRECTORY_SEPARATOR.'only.lock';

View File

@ -1,5 +1,5 @@
Pest Testing Framework 2.32.2. Pest Testing Framework 2.34.1.
USAGE: pest <file> [options] USAGE: pest <file> [options]
@ -55,6 +55,7 @@
--stop-on-notice ............. Stop after first test that triggered a notice --stop-on-notice ............. Stop after first test that triggered a notice
--stop-on-skipped ............................ Stop after first skipped test --stop-on-skipped ............................ Stop after first skipped test
--stop-on-incomplete ...................... Stop after first incomplete test --stop-on-incomplete ...................... Stop after first incomplete test
--fail-on-empty-test-suite Signal failure using shell exit code when no tests were run
--fail-on-warning Signal failure using shell exit code when a warning was triggered --fail-on-warning Signal failure using shell exit code when a warning was triggered
--fail-on-risky Signal failure using shell exit code when a test was considered risky --fail-on-risky Signal failure using shell exit code when a test was considered risky
--fail-on-deprecation Signal failure using shell exit code when a deprecation was triggered --fail-on-deprecation Signal failure using shell exit code when a deprecation was triggered

View File

@ -1,3 +1,3 @@
Pest Testing Framework 2.32.2. Pest Testing Framework 2.34.1.

View File

@ -1167,6 +1167,16 @@
PASS Tests\Hooks\BeforeEachTest PASS Tests\Hooks\BeforeEachTest
✓ global beforeEach execution order ✓ global beforeEach execution order
PASS Tests\Overrides\VersionsTest
✓ versions with dataset "Runner/Filter/NameFilterIterator.php"
✓ versions with dataset "Runner/ResultCache/DefaultResultCache.php"
✓ versions with dataset "Runner/TestSuiteLoader.php"
✓ versions with dataset "TextUI/Command/Commands/WarmCodeCoverageCacheCommand.php"
✓ versions with dataset "TextUI/Output/Default/ProgressPrinter/Subscriber/TestSkippedSubscriber.php"
✓ versions with dataset "TextUI/TestSuiteFilterProcessor.php"
✓ versions with dataset "Event/Value/ThrowableBuilder.php"
✓ versions with dataset "Logging/JUnit/JunitXmlLogger.php"
PASS Tests\PHPUnit\CustomAffixes\InvalidTestName PASS Tests\PHPUnit\CustomAffixes\InvalidTestName
✓ it runs file names like @#$%^&()-_=+.php ✓ it runs file names like @#$%^&()-_=+.php
@ -1379,6 +1389,10 @@
PASS Tests\Visual\Help PASS Tests\Visual\Help
✓ visual snapshot of help command output ✓ visual snapshot of help command output
PASS Tests\Visual\JUnit
✓ junit output
✓ junit with parallel
PASS Tests\Visual\Parallel PASS Tests\Visual\Parallel
✓ parallel ✓ parallel
✓ a parallel test can extend another test with same name ✓ a parallel test can extend another test with same name
@ -1404,4 +1418,4 @@
WARN Tests\Visual\Version WARN Tests\Visual\Version
- visual snapshot of help command output - visual snapshot of help command output
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 999 passed (2359 assertions) Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 20 skipped, 1009 passed (2395 assertions)

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
use Pest\Bootstrappers\BootOverrides;
test('versions', function (string $vendorPath, string $expectedHash) {
expect(hash_file('sha256', $vendorPath))->toBe($expectedHash);
})->with(function () {
foreach (BootOverrides::FILES as $hash => $file) {
$path = implode(DIRECTORY_SEPARATOR, [
dirname(__DIR__, 2),
'vendor/phpunit/phpunit/src',
$file,
]);
yield $file => [$path, $hash];
}
});

79
tests/Visual/JUnit.php Normal file
View File

@ -0,0 +1,79 @@
<?php
use Symfony\Component\Process\Process;
$run = function () {
$junitLogFile = tempnam(sys_get_temp_dir(), 'junit');
$process = new Process(
array_merge(['php', 'bin/pest', '--log-junit', $junitLogFile], func_get_args()),
dirname(__DIR__, 2),
['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true'],
);
$process->run();
$rawXmlContent = file_get_contents($junitLogFile);
unlink($junitLogFile);
// convert xml to array
try {
$xml = new SimpleXMLElement(preg_replace("/(<\/?)(\w+):([^>]*>)/", '$1$2$3', $rawXmlContent));
return json_decode(json_encode((array) $xml), true);
} catch (Exception $exception) {
throw new XmlParseException($exception->getMessage(), $exception->getCode(), $exception->getPrevious());
}
};
$normalizedPath = function (string $path) {
return str_replace('/', DIRECTORY_SEPARATOR, $path);
};
test('junit output', function () use ($normalizedPath, $run) {
$result = $run('tests/.tests/SuccessOnly.php');
expect($result['testsuite']['@attributes'])
->name->toBe('Tests\tests\SuccessOnly')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php'))
->tests->toBe('2')
->assertions->toBe('2')
->errors->toBe('0')
->failures->toBe('0')
->skipped->toBe('0');
expect($result['testsuite']['testcase'])
->toHaveCount(2);
expect($result['testsuite']['testcase'][0]['@attributes'])
->name->toBe('it can pass with comparison')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))
->class->toBe('Tests\tests\SuccessOnly')
->classname->toBe('Tests.tests.SuccessOnly')
->assertions->toBe('1')
->time->toStartWith('0.0');
});
test('junit with parallel', function () use ($normalizedPath, $run) {
$result = $run('tests/.tests/SuccessOnly.php', '--parallel', '--processes=1', '--filter', 'can pass with comparison');
expect($result['testsuite']['@attributes'])
->name->toBe('Tests\tests\SuccessOnly')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php'))
->tests->toBe('1')
->assertions->toBe('1')
->errors->toBe('0')
->failures->toBe('0')
->skipped->toBe('0');
expect($result['testsuite']['testcase'])
->toHaveCount(1);
expect($result['testsuite']['testcase']['@attributes'])
->name->toBe('it can pass with comparison')
->file->toBe($normalizedPath('tests/.tests/SuccessOnly.php::it can pass with comparison'))
->class->toBe('Tests\tests\SuccessOnly')
->classname->toBe('Tests.tests.SuccessOnly')
->assertions->toBe('1')
->time->toStartWith('0.0');
});

View File

@ -16,7 +16,7 @@ $run = function () {
test('parallel', function () use ($run) { test('parallel', function () use ($run) {
expect($run('--exclude-group=integration')) expect($run('--exclude-group=integration'))
->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 986 passed (2340 assertions)') ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 16 skipped, 994 passed (2348 assertions)')
->toContain('Parallel: 3 processes'); ->toContain('Parallel: 3 processes');
})->skipOnWindows(); })->skipOnWindows();