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
20 changes: 19 additions & 1 deletion packages/b2c-cli/test/functional/e2e/sandbox-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,28 @@ describe('Sandbox Lifecycle E2E Tests', function () {
describe('Realm Management', function () {
const realmId = process.env.TEST_REALM;

before(function () {
before(async function () {
if (!realmId) {
this.skip();
}

// Perform a lightweight realm health check so all realm tests can
// assume the realm is basically available. If the realm is missing
// or misconfigured skip the Realm Management tests
const result = await runCLIWithRetry(['sandbox', 'realm', 'get', realmId!, '--json'], {verbose: true});

if (result.exitCode !== 0) {
const errorText = String(result.stderr || result.stdout || '');
if (
errorText.includes('Realm not found') ||
errorText.includes('Failed to fetch configuration for realm') ||
errorText.includes('ConnectTimeoutError') ||
errorText.includes('CronExpression')
) {
console.log(' ⚠ Realm not available or misconfigured; skipping Realm Management tests:', errorText);
this.skip();
}
}
});

it('should get realm details', async function () {
Expand Down
8 changes: 7 additions & 1 deletion packages/b2c-cli/test/functional/e2e/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,13 @@ export async function runCLI(args: string[], options: CLIOptions = {}): Promise<
cwd,
});

return result;
const normalizedExitCode =
typeof result.exitCode === 'number' ? result.exitCode : ((result as any).code ?? (result as any).status ?? 1);

return {
...result,
exitCode: normalizedExitCode,
};
}

/**
Expand Down
Loading