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
2 changes: 1 addition & 1 deletion 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.7.7",
"version": "3.7.8",
"private": true,
"license": "MIT",
"repository": {
Expand Down
3 changes: 1 addition & 2 deletions src/Handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export class Handler {
const xdebug = new Xdebug(this.configuration);
builder.setXdebug(xdebug);

xdebug.setMode(request.profile?.kind);

await xdebug.setMode(request.profile?.kind);
if (xdebug.mode === Mode.debug) {
// TODO: perhaps wait for the debug session
await debug.startDebugging(wsf, xdebug.name ?? await xdebug.getDebugConfiguration());
Expand Down
11 changes: 4 additions & 7 deletions src/PHPUnit/CommandBuilder/Xdebug.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as net from 'net';
import { mkdtempSync } from 'node:fs';
import { mkdtemp } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { IConfiguration } from '../Configuration';
Expand Down Expand Up @@ -54,7 +54,7 @@ export class Xdebug {
return this;
}

setMode(mode?: Mode | number) {
async setMode(mode?: Mode | number) {
if (typeof mode !== 'number') {
this.mode = mode;

Expand All @@ -64,21 +64,18 @@ export class Xdebug {
// export enum TestRunProfileKind { Run = 1, Debug = 2, Coverage = 3 }
if (mode === 2) {
this.mode = Mode.debug;
this.port = this.configuration.get('xdebugPort', 0) as number || await getFreePort();
}

if (mode === 3) {
this.mode = Mode.coverage;
this.setTemporaryDirectory(mkdtempSync(join(tmpdir(), 'phpunit-')));
this.setTemporaryDirectory(await mkdtemp(join(tmpdir(), 'phpunit')));
}

return this;
}

private async getPort() {
if (!this.port) {
this.port = this.configuration.get('xdebugPort', await getFreePort()) as number;
}

return this.port;
}

Expand Down