Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"displayName": "PHPUnit Test Explorer",
"icon": "img/icon.png",
"publisher": "recca0120",
"version": "3.8.1",
"version": "3.8.2",
"private": true,
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -49,7 +49,10 @@
{
"language": "phpunit",
"scopeName": "source.phpunit",
"path": "./syntaxes/phpunit.tmLanguage.json"
"path": "./syntaxes/collision.tmLanguage.json",
"embeddedLanguages": {
"meta.embedded.php.phpunit": "php"
}
}
],
"commands": [
Expand Down
16 changes: 8 additions & 8 deletions src/Observers/Printers/CollisionPrinter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('CollisionPrinter', () => {
duration: 0,
});

expect(output).toEqual('✅ passed 0 ms');
expect(output).toEqual(' ✅ passed 0 ms');
});

it('testFailed', () => {
Expand All @@ -80,12 +80,12 @@ describe('CollisionPrinter', () => {
duration: 0,
});

expect(output).toEqual([`❌ failed 0 ms`].join(EOL));
expect(output).toEqual([` ❌ failed 0 ms`].join(EOL));

expect(printer.end()).toEqual(
[
``,
`❌ FAILED Recca0120\\VSCode\\Tests\\AssertionsTest > failed`,
` ❌ FAILED Recca0120\\VSCode\\Tests\\AssertionsTest > failed`,
`Failed asserting that false is true.`,
``,
`at ${OutputFormatter.fileFormat(phpUnitProject('tests/AssertionsTest.php'), 27)}`,
Expand Down Expand Up @@ -127,12 +127,12 @@ describe('CollisionPrinter', () => {
expected: "Array &0 [\n 'a' => 'b',\n 'c' => 'd',\n]",
});

expect(output).toEqual([`❌ is_not_same 29 ms`].join(EOL));
expect(output).toEqual([` ❌ is_not_same 29 ms`].join(EOL));

expect(printer.end()).toEqual(
[
``,
`❌ FAILED Recca0120\\VSCode\\Tests\\AssertionsTest > is_not_same`,
` ❌ FAILED Recca0120\\VSCode\\Tests\\AssertionsTest > is_not_same`,
`Failed asserting that two arrays are identical.`,
` Array &0 [`,
`- 'a' => 'b',`,
Expand Down Expand Up @@ -208,12 +208,12 @@ describe('CollisionPrinter', () => {
duration: 0,
});

expect(output).toEqual([`❌ failed 0 ms`].join(EOL));
expect(output).toEqual([` ❌ failed 0 ms`].join(EOL));

expect(printer.end()).toEqual(
[
``,
`❌ FAILED Recca0120\\VSCode\\Tests\\NotFoundTest > failed`,
` ❌ FAILED Recca0120\\VSCode\\Tests\\NotFoundTest > failed`,
`Failed asserting that false is true.`,
``,
`1. ${OutputFormatter.fileFormat(phpUnitProject('tests/NotFoundTest.php'), 22)}`,
Expand Down Expand Up @@ -251,7 +251,7 @@ describe('CollisionPrinter', () => {
});

expect(output).toEqual(
[`➖ skipped ➜ The MySQLi extension is not available. 0 ms`].join(EOL),
[` ➖ skipped ➜ The MySQLi extension is not available. 0 ms`].join(EOL),
);
});
});
8 changes: 4 additions & 4 deletions src/Observers/Printers/CollisionPrinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export class CollisionPrinter extends OutputFormatter {
}

if (result.event === TeamcityEvent.testIgnored) {
return `${icon} ${name} ➜ ${(result as TestIgnored).message} ${result.duration} ms`;
return ` ${icon} ${name} ➜ ${(result as TestIgnored).message} ${result.duration} ms`;
}

return `${icon} ${name} ${result.duration} ms`;
return ` ${icon} ${name} ${result.duration} ms`;
}

testSuiteFinished(_result: TestSuiteFinished): string | undefined {
Expand Down Expand Up @@ -61,11 +61,11 @@ export class CollisionPrinter extends OutputFormatter {
const [icon, message] = this.messages.get(result.event)!;
const parts = result.id.split('::');
if (parts.length < 2) {
return `${icon} ${message} ${result.id}`;
return ` ${icon} ${message} ${result.id}`;
}

const [className, method] = parts;
return `${icon} ${message} ${className} > ${method.replace(/^test_/, '')}`;
return ` ${icon} ${message} ${className} > ${method.replace(/^test_/, '')}`;
}

private formatMessage(result: TestFailed) {
Expand Down
123 changes: 123 additions & 0 deletions syntaxes/collision.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "PHPUnit",
"patterns": [
{
"comment": "Passed test line → green",
"match": "^\\s+✅\\s+.+\\d+\\s*ms",
"name": "markup.inserted.phpunit"
},
{
"comment": "Failed test line → red (ends with ms)",
"match": "^\\s+❌\\s+.+\\d+\\s*ms",
"name": "invalid.phpunit"
},
{
"comment": "Ignored/skipped test line → yellow",
"match": "^\\s+➖\\s+.+",
"name": "markup.deleted.phpunit"
},
{
"comment": "FAILED error title → only icon+FAILED red, rest default",
"match": "^(\\s+❌\\s+FAILED)(\\s+.+)",
"captures": {
"1": { "name": "invalid.phpunit" }
}
},
{
"comment": "Error line without indent → red",
"match": "^❌\\s+.+",
"name": "invalid.phpunit"
},
{
"comment": "Printed output → yellow",
"match": "^🟨\\s+.+",
"name": "markup.deleted.phpunit"
},
{
"comment": "Arrow source line → arrow+number highlighted, ▕ gray, code PHP",
"match": "(➜\\s+\\d+\\s+)(▕)(\\s?.*$)",
"captures": {
"1": { "name": "keyword.phpunit" },
"2": { "name": "comment.phpunit" },
"3": {
"name": "meta.embedded.php.phpunit",
"patterns": [{ "include": "source.php" }]
}
}
},
{
"comment": "Source line → line number gray, ▕ gray, code PHP",
"match": "(\\s+\\d+\\s+)(▕)(\\s?.*$)",
"captures": {
"1": { "name": "comment.phpunit" },
"2": { "name": "comment.phpunit" },
"3": {
"name": "meta.embedded.php.phpunit",
"patterns": [{ "include": "source.php" }]
}
}
},
{
"comment": "at file reference → link",
"match": "^at\\s+\\S+\\.php:\\d+",
"name": "string.link.phpunit"
},
{
"comment": "File path links",
"match": "\\S+\\.php:\\d+",
"name": "string.link.phpunit"
},
{
"comment": "Diff removed line → red",
"match": "^-\\s+.+",
"name": "invalid.phpunit"
},
{
"comment": "Diff added line → green",
"match": "^\\+\\s+.+",
"name": "markup.inserted.phpunit"
},
{
"comment": "PrettyPrinter box lines → gray",
"match": "^\\s+[┐├│┴┊].*",
"name": "comment.phpunit"
},
{
"comment": "Pest summary: N failed → red",
"match": "\\d+\\s+failed",
"name": "invalid.phpunit"
},
{
"comment": "Pest summary: N passed → green",
"match": "\\d+\\s+passed",
"name": "markup.inserted.phpunit"
},
{
"comment": "Pest summary: N skipped → yellow",
"match": "\\d+\\s+skipped",
"name": "markup.deleted.phpunit"
},
{
"comment": "PHPUnit summary: Errors/Failures → red",
"match": "(Errors|Failures):\\s+\\d+",
"name": "invalid.phpunit"
},
{
"comment": "PHPUnit summary: Skipped/Incomplete/Risky/Warnings/Deprecations → yellow",
"match": "(Skipped|Incomplete|Risky|Warnings|PHPUnit Deprecations):\\s+\\d+",
"name": "markup.deleted.phpunit"
},
{
"comment": "Info lines → gray",
"match": "^(Time|Duration|Runtime|Configuration|Processes):.*",
"name": "comment.phpunit"
},
{
"comment": "Duration at end of line → gray",
"match": "\\d+\\s*ms$",
"name": "comment.phpunit"
}
],
"scopeName": "source.phpunit"
}
15 changes: 0 additions & 15 deletions syntaxes/phpunit.tmLanguage.json

This file was deleted.