fix(FN-2321): standardize loopback-gated integration test labeling
- Refine the dashboard loopback integration helper with documented helper contracts and centralized skipped-name formatting - Keep loopback bind detection memoized so all gated integration suites share one environment probe - Update loopback-gated dashboard suites to use consistent, explicit scope labels in skip output - Refresh skipped-test inventory docs with the new audit commands and loopback helper usage details
This commit is contained in:
@@ -5,6 +5,15 @@ type IntegrationTestCase = (name: string, fn: () => unknown | Promise<unknown>,
|
||||
|
||||
const LOOPBACK_SKIP_REASON = "loopback binding to 127.0.0.1 is unavailable in this environment";
|
||||
|
||||
/**
|
||||
* Ensure skip output is auditable with both the standardized reason and the suite scope.
|
||||
*
|
||||
* Example: "... (skipped: loopback binding to 127.0.0.1 is unavailable in this environment; scope: websocket integration)"
|
||||
*/
|
||||
function formatLoopbackSkipName(testName: string, scope: string): string {
|
||||
return `${testName} (skipped: ${LOOPBACK_SKIP_REASON}; scope: ${scope})`;
|
||||
}
|
||||
|
||||
let loopbackBindingAvailablePromise: Promise<boolean> | null = null;
|
||||
|
||||
async function detectLoopbackBinding(): Promise<boolean> {
|
||||
@@ -17,6 +26,10 @@ async function detectLoopbackBinding(): Promise<boolean> {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Memoize loopback probe results so all integration suites share a single bind check.
|
||||
* This avoids creating redundant probe listeners during test startup.
|
||||
*/
|
||||
async function isLoopbackBindingAvailable(): Promise<boolean> {
|
||||
if (!loopbackBindingAvailablePromise) {
|
||||
loopbackBindingAvailablePromise = detectLoopbackBinding();
|
||||
@@ -25,6 +38,12 @@ async function isLoopbackBindingAvailable(): Promise<boolean> {
|
||||
return await loopbackBindingAvailablePromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Canonical gate for dashboard integration tests that require loopback binding.
|
||||
*
|
||||
* When loopback is unavailable, every skipped test name includes a standardized
|
||||
* reason string and the provided suite scope for auditability in test output.
|
||||
*/
|
||||
export async function createLoopbackIntegrationTest(scope: string): Promise<IntegrationTestCase> {
|
||||
const loopbackBindingAvailable = await isLoopbackBindingAvailable();
|
||||
|
||||
@@ -32,5 +51,5 @@ export async function createLoopbackIntegrationTest(scope: string): Promise<Inte
|
||||
return (name, fn, timeout) => it(name, fn, timeout);
|
||||
}
|
||||
|
||||
return (name, fn, timeout) => it.skip(`${name} (skipped: ${LOOPBACK_SKIP_REASON}; scope: ${scope})`, fn, timeout);
|
||||
return (name, fn, timeout) => it.skip(formatLoopbackSkipName(name, scope), fn, timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user