diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d45b90ee..e8733b0f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] # "windows-latest" is waiting for https://github.com/pestphp/pest/issues/638 + os: [ubuntu-latest, macos-latest, windows-latest] php: ['8.1', '8.2'] dependency-version: [prefer-lowest, prefer-stable] parallel: ['', '--parallel'] diff --git a/src/Logging/TeamCity/Converter.php b/src/Logging/TeamCity/Converter.php index 31495162..c0d91d41 100644 --- a/src/Logging/TeamCity/Converter.php +++ b/src/Logging/TeamCity/Converter.php @@ -175,7 +175,7 @@ final class Converter private function toRelativePath(string $path): string { // Remove cwd from the path. - return str_replace("$this->rootPath/", '', $path); + return str_replace("$this->rootPath".DIRECTORY_SEPARATOR, '', $path); } /** diff --git a/src/Support/Backtrace.php b/src/Support/Backtrace.php index 5077fb5a..78d7cfc7 100644 --- a/src/Support/Backtrace.php +++ b/src/Support/Backtrace.php @@ -54,7 +54,9 @@ final class Backtrace foreach (debug_backtrace(self::BACKTRACE_OPTIONS) as $trace) { assert(array_key_exists(self::FILE, $trace)); - if (Str::endsWith($trace['file'], 'Bootstrappers/BootFiles.php') || Str::endsWith($trace[self::FILE], 'overrides/Runner/TestSuiteLoader.php')) { + $traceFile = str_replace(DIRECTORY_SEPARATOR, '/', $trace[self::FILE]); + + if (Str::endsWith($traceFile, 'Bootstrappers/BootFiles.php') || Str::endsWith($traceFile, 'overrides/Runner/TestSuiteLoader.php')) { break; } diff --git a/tests/.snapshots/Failure.php.inc b/tests/.snapshots/Failure.php.inc index 5a422a49..01046cc7 100644 --- a/tests/.snapshots/Failure.php.inc +++ b/tests/.snapshots/Failure.php.inc @@ -1,4 +1,4 @@ -##teamcity[testSuiteStarted name='Tests\tests\Failure' locationHint='file://tests/.tests/Failure.php' flowId='1234'] +##teamcity[testSuiteStarted name='Tests/tests/Failure' locationHint='file://tests/.tests/Failure.php' flowId='1234'] ##teamcity[testStarted name='it can fail with comparison' locationHint='pest_qn://tests/.tests/Failure.php::it can fail with comparison' flowId='1234'] ##teamcity[testFailed name='it can fail with comparison' message='Failed asserting that true matches expected false.' details='at src/Mixins/Expectation.php:312|nat src/Support/ExpectationPipeline.php:75|nat src/Support/ExpectationPipeline.php:79|nat src/Expectation.php:300|nat tests/.tests/Failure.php:6|nat src/Factories/TestCaseMethodFactory.php:106|nat src/Concerns/Testable.php:262|nat src/Support/ExceptionTrace.php:28|nat src/Concerns/Testable.php:262|nat src/Concerns/Testable.php:217|nat src/Kernel.php:79' type='comparisonFailure' actual='true' expected='false' flowId='1234'] ##teamcity[testFinished name='it can fail with comparison' duration='100000' flowId='1234'] @@ -17,7 +17,7 @@ ##teamcity[testStarted name='build this one.' locationHint='pest_qn://tests/.tests/Failure.php::build this one.' flowId='1234'] ##teamcity[testIgnored name='build this one.' message='This test was ignored.' details='' flowId='1234'] ##teamcity[testFinished name='build this one.' duration='100000' flowId='1234'] -##teamcity[testSuiteFinished name='Tests\tests\Failure' flowId='1234'] +##teamcity[testSuiteFinished name='Tests/tests/Failure' flowId='1234'] Tests: 2 failed, 1 risky, 2 todos, 1 skipped (2 assertions) Duration: 1.00s diff --git a/tests/.snapshots/SuccessOnly.php.inc b/tests/.snapshots/SuccessOnly.php.inc index cdcb71a9..21e8a362 100644 --- a/tests/.snapshots/SuccessOnly.php.inc +++ b/tests/.snapshots/SuccessOnly.php.inc @@ -1,9 +1,9 @@ -##teamcity[testSuiteStarted name='Tests\tests\SuccessOnly' locationHint='file://tests/.tests/SuccessOnly.php' flowId='1234'] +##teamcity[testSuiteStarted name='Tests/tests/SuccessOnly' locationHint='file://tests/.tests/SuccessOnly.php' flowId='1234'] ##teamcity[testStarted name='it can pass with comparison' locationHint='pest_qn://tests/.tests/SuccessOnly.php::it can pass with comparison' flowId='1234'] ##teamcity[testFinished name='it can pass with comparison' duration='100000' flowId='1234'] ##teamcity[testStarted name='can also pass' locationHint='pest_qn://tests/.tests/SuccessOnly.php::can also pass' flowId='1234'] ##teamcity[testFinished name='can also pass' duration='100000' flowId='1234'] -##teamcity[testSuiteFinished name='Tests\tests\SuccessOnly' flowId='1234'] +##teamcity[testSuiteFinished name='Tests/tests/SuccessOnly' flowId='1234'] Tests: 2 passed (2 assertions) Duration: 1.00s diff --git a/tests/Visual/TeamCity.php b/tests/Visual/TeamCity.php index 0ea3bc08..c02ee21e 100644 --- a/tests/Visual/TeamCity.php +++ b/tests/Visual/TeamCity.php @@ -1,5 +1,12 @@ toEqual(file_get_contents($snapshot)); + expect(normalize_windows_os_output($output()))->toEqual(file_get_contents($snapshot)); } })->with([ 'Failure.php',