Skip to content
Open
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
35 changes: 1 addition & 34 deletions e2e-tests/plugin-dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
log,
logSection,
runCommand,
runExpectingFailure,
RunCommandOptions,
} from './support/plugin-export-build';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[medium] pattern-violation

RunCommandOptions is imported but no longer used anywhere in the file. The only consumer was the local runExpectingFailure function, which was removed and promoted to the shared support module in this PR. The stale import will produce an unused-import lint error and fail yarn lint:check in CI.

Suggested fix: Remove RunCommandOptions from the import block on line 22.

import {
Expand All @@ -33,40 +34,6 @@ const availableTools = detectAvailableComposeToolsSync();
const describeWithCompose =
availableTools.length > 0 ? describe : describe.skip;

async function runExpectingFailure(
command: string,
options: RunCommandOptions = {},
): Promise<{ stdout: string; stderr: string; message: string }> {
let succeeded = false;
let stdout = '';
let caughtError: unknown;

try {
const res = await runCommand(command, options);
succeeded = true;
stdout = res.stdout;
} catch (err: unknown) {
caughtError = err;
}

if (succeeded) {
throw new Error(
`Command expected to fail, but succeeded with output: ${stdout}`,
);
}

const e = (caughtError || {}) as {
stdout?: string;
stderr?: string;
message?: string;
};
return {
stdout: e?.stdout || '',
stderr: e?.stderr || '',
message: e?.message || '',
};
}

describe('plugin dev', () => {
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'rhdh-cli-plugin-dev-'));
const pluginDir = path.join(tmpDir, 'test-frontend-plugin');
Expand Down
Loading
Loading