Skip to content

Commit e182f3b

Browse files
authored
Merge pull request #394 from recca0120/refactor/printer
refactor: support ANSI color output in Test Result Panel
2 parents 6eacf8c + 598dcc9 commit e182f3b

53 files changed

Lines changed: 3446 additions & 1761 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/extension/package.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,6 @@
3939
"configuration": "./language-configuration.json"
4040
}
4141
],
42-
"grammars": [
43-
{
44-
"language": "phpunit",
45-
"scopeName": "source.phpunit",
46-
"path": "./syntaxes/collision.tmLanguage.json",
47-
"embeddedLanguages": {
48-
"meta.embedded.php.phpunit": "php",
49-
"meta.embedded.vardumper.phpunit": "phpunit"
50-
}
51-
},
52-
{
53-
"scopeName": "source.vardumper",
54-
"path": "./syntaxes/vardumper.tmLanguage.json"
55-
}
56-
],
5742
"commands": [
5843
{
5944
"command": "phpunit.reload",
@@ -149,6 +134,22 @@
149134
"title": "Set environment variables before running the phpunit command",
150135
"scope": "resource"
151136
},
137+
"phpunit.output.preset": {
138+
"type": "string",
139+
"enum": [
140+
"phpunit",
141+
"collision"
142+
],
143+
"default": "collision",
144+
"description": "Output format preset. 'collision' shows detailed per-test results; 'phpunit' shows dot-progress.",
145+
"scope": "resource"
146+
},
147+
"phpunit.output.format": {
148+
"type": "object",
149+
"default": {},
150+
"description": "Override individual format fields from the preset. See documentation for available fields.",
151+
"scope": "resource"
152+
},
152153
"phpunit.clearOutputOnRun": {
153154
"type": "boolean",
154155
"default": true,

packages/extension/src/Observers/ErrorDialogObserver.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type { IConfiguration, TestRunnerObserver } from '@vscode-phpunit/phpunit';
2+
import stripAnsi from 'strip-ansi';
23
import { window } from 'vscode';
34

45
export class ErrorDialogObserver implements TestRunnerObserver {
56
constructor(private configuration: IConfiguration) {}
67

78
async error(error: string) {
9+
error = stripAnsi(error);
810
if (error.includes('Pest\\Exceptions\\InvalidPestCommand')) {
911
const command = 'vendor/bin/pest';
1012
const message = `Update "phpunit.phpunit" to ${command} ?`;

0 commit comments

Comments
 (0)