Skip to content

Commit 65ab3d5

Browse files
committed
Recognize TeamCity PHPUnit completion
1 parent 532e3f7 commit 65ab3d5

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

packages/runtime-playground/src/wordpress-command-runners.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,7 @@ export async function runPhpunitCommand({
980980

981981
export function hasSuccessfulPhpunitSummary(output: string): boolean {
982982
return /\bOK(?:, but (?:there were issues!|incomplete, skipped, or risky tests!))?(?: \([1-9]\d* tests?,|\s+Tests:\s*[1-9]\d*,\s*Assertions:)/m.test(output)
983+
|| (/##teamcity\[testStarted\b/m.test(output) && /##teamcity\[testSuiteFinished\b/m.test(output))
983984
}
984985

985986
function successfulPhpunitResponseDiagnostics(response: PlaygroundRunResponse): string {

tests/phpunit-runtime-failure-diagnostics.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const emptySuccessArtifactRoot = await mkdtemp(join(tmpdir(), "wp-codebox-phpuni
5353
const successfulResponseSecret = "ghp_abcdefghijklmnopqrstuvwxyz1234567890"
5454
assert.equal(hasSuccessfulPhpunitSummary("OK (1 test, 1 assertion)"), true)
5555
assert.equal(hasSuccessfulPhpunitSummary("OK, but incomplete, skipped, or risky tests!\nTests: 21, Assertions: 27398, Skipped: 1."), true)
56+
assert.equal(hasSuccessfulPhpunitSummary("##teamcity[testSuiteStarted name='example']\n##teamcity[testStarted name='works']\n##teamcity[testFinished name='works']\n##teamcity[testSuiteFinished name='example']"), true)
57+
assert.equal(hasSuccessfulPhpunitSummary("##teamcity[testSuiteStarted name='example']\n##teamcity[testSuiteFinished name='example']"), false)
5658
assert.equal(hasSuccessfulPhpunitSummary("Tests: 21, Assertions: 27398, Failures: 1."), false)
5759
await assert.rejects(
5860
() => runPhpunitCommand({

0 commit comments

Comments
 (0)