Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Commit eba3029

Browse files
committed
🔧 test: enhance error handling and improve type definitions
1 parent e7807a1 commit eba3029

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/test/ddev-utils.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@
1919

2020
import * as assert from 'assert';
2121
import * as sinon from 'sinon';
22-
import { afterEach, beforeEach } from 'mocha';
22+
import { afterEach, beforeEach, test } from 'mocha';
2323
import { DdevUtils, sys } from '../shared/utils/ddev-utils';
2424

25+
interface ExecDdevError extends Error {
26+
status: number;
27+
stderr: string;
28+
stdout?: string;
29+
command?: string;
30+
workspacePath?: string;
31+
}
32+
2533
suite('DdevUtils Test Suite', () => {
2634
let sandbox: sinon.SinonSandbox;
2735
let spawnSyncStub: sinon.SinonStub;
@@ -106,7 +114,7 @@ suite('DdevUtils Test Suite', () => {
106114
const result = DdevUtils.validateDdevTool('phpstan', '/test/workspace');
107115

108116
assert.strictEqual(result.isValid, true);
109-
assert.ok(result.errorType === undefined);
117+
assert.strictEqual(result.errorType, undefined);
110118
});
111119

112120
test('validateDdevTool returns error message for DDEV issues', () => {
@@ -159,7 +167,7 @@ suite('DdevUtils Test Suite', () => {
159167

160168
assert.throws(() => {
161169
DdevUtils.execDdev(['ls'], '/test/workspace');
162-
}, (err: { status: number; stderr: string; stdout?: string; command?: string; workspacePath?: string; name?: string }) => {
170+
}, (err: ExecDdevError) => {
163171
return err.status === 1 && err.stderr === 'error';
164172
});
165173
});

0 commit comments

Comments
 (0)