Skip to content
Merged
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
9 changes: 5 additions & 4 deletions src/test/ddev-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ suite('DdevUtils Test Suite', () => {
spawnSyncStub.onSecondCall().returns({ status: 1, stderr: 'DDEV not running' });

const result = DdevUtils.validateDdevTool('phpstan', '/test/workspace');
const expectedMessage = "DDEV project appears to be stopped. Please start DDEV with 'ddev start' to use phpstan.";

assert.strictEqual(result.isValid, false);
assert.strictEqual(result.errorType, 'ddev-not-running');
assert.ok(result.userMessage && result.userMessage.includes('appears to be stopped'));
assert.strictEqual(result.userMessage, expectedMessage);
});

test('validateDdevTool returns tool not found message when tool is missing', () => {
Expand All @@ -133,11 +134,11 @@ suite('DdevUtils Test Suite', () => {
spawnSyncStub.onSecondCall().returns({ status: 0, stdout: 'test\n' });

const result = DdevUtils.validateDdevTool('phpstan', '/test/workspace');
const expectedMessage = 'phpstan is not installed in the DDEV container. Install it with: ddev composer require --dev phpstan/phpstan';

assert.strictEqual(result.isValid, false);
assert.strictEqual(result.errorType, 'tool-not-found');
assert.ok(result.userMessage?.includes('phpstan is not installed'));
assert.ok(result.userMessage?.includes('phpstan/phpstan'));
assert.strictEqual(result.userMessage, expectedMessage);
});

test('execDdev passes args array correctly', () => {
Expand All @@ -158,7 +159,7 @@ suite('DdevUtils Test Suite', () => {

assert.throws(() => {
DdevUtils.execDdev(['ls'], '/test/workspace');
}, (err: any) => {
}, (err: { status: number; stderr: string; stdout?: string; command?: string; workspacePath?: string; name?: string }) => {
return err.status === 1 && err.stderr === 'error';
});
});
Expand Down