@fabricorg/databricks-bdd 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/dist/{chunk-FNTI2VUP.js → chunk-355WDWP3.js} +18 -3
- package/dist/chunk-355WDWP3.js.map +1 -0
- package/dist/chunk-SZL3KWW7.js +62 -0
- package/dist/chunk-SZL3KWW7.js.map +1 -0
- package/dist/fixtures.cjs +65 -0
- package/dist/fixtures.cjs.map +1 -0
- package/dist/fixtures.d.cts +34 -0
- package/dist/fixtures.d.ts +34 -0
- package/dist/fixtures.js +3 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/index.cjs +78 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/steps.cjs +79 -1
- package/dist/steps.cjs.map +1 -1
- package/dist/steps.js +8 -3
- package/dist/steps.js.map +1 -1
- package/package.json +11 -1
- package/dist/chunk-FNTI2VUP.js.map +0 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/world.ts","../src/profile.ts","../src/infer.ts","../src/jobs.ts","../src/pipelines.ts","../src/run-features.ts","../src/parameter-types.ts","../src/evidence-formatter.ts","../src/output-capture.ts"],"names":["World","resolveProfile","createExecutionContext","waitForDatabricksRun","require","createRequire","join","dirname","execFile","format"],"mappings":";;;;;;;;;;;;AAuBO,IAAM,eAAA,GAAN,cAA8BA,cAAA,CAAiC;AAAA,EAC3D,OAAA;AAAA;AAAA,EAET,QAAA,GAA6C,IAAA;AAAA;AAAA,EAE7C,SAAA,GAA0B,IAAA;AAAA;AAAA,EAE1B,OAAA,GAA0C,IAAA;AAAA;AAAA,EAE1C,kBAAA,GAAsE,IAAA;AAAA,EACtE,cAAA;AAAA,EACA,eAAA;AAAA,EACA,OAAA;AAAA,EACA,e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AAC,QAAA,CAAS,QAAA,CAAS,IAAI,GAAG,QAAA,IAAY,IAAA;AACtD,MAAA,QAAA,IAAY,CAAA,CAAA,EAAI,MAAM,MAAM,CAAA;AAAA,CAAA;AAC5B,MAAA,QAAA,GAAW,KAAA,CAAM,MAAA;AAAA,IACnB;AACA,IAAA,QAAA,IAAY,KAAA,CAAM,IAAA;AAAA,EACpB;AACA,EAAA,OAAO,SAAS,OAAA,EAAQ;AAC1B","file":"index.cjs","sourcesContent":["import { type IWorldOptions, World } from '@cucumber/cucumber';\nimport {\n type ExecutionContext,\n type TestProfile,\n createExecutionContext,\n resolveProfile,\n} from '@fabricorg/databricks-testkit';\nimport type { StepOutputCapture } from './output-capture.js';\n\nexport interface DatabricksWorldParameters {\n /** Default schema for the execution context; overridable per scenario via the catalog/schema step. */\n schema?: string;\n /** Arbitrary typed runner configuration, comparable to behave `-D` userdata. */\n userdata?: Record<string, string | number | boolean>;\n}\n\ntype Cleanup = () => void | Promise<void>;\n\n/**\n * Cucumber World holding one ExecutionContext per scenario. The context is\n * created lazily on first use so `Given catalog ... and schema ...` can run\n * first; it is closed by the After hook registered in ./steps.ts.\n */\nexport class DatabricksWorld extends World<DatabricksWorldParameters> {\n readonly profile: TestProfile;\n /** Rows from the last `When I run the SQL` / `When I query table` step. */\n lastRows: Record<string, unknown>[] | null = null;\n /** Error captured from the last statement, for `Then the statement fails ...`. */\n lastError: Error | null = null;\n /** Terminal run record from the last `When I run job ...` step. */\n lastRun: Record<string, unknown> | null = null;\n /** Pipeline update handle from `When I start a full refresh of pipeline ...`. */\n lastPipelineUpdate: { pipelineId: string; updateId: string } | null = null;\n schemaOverride: string | undefined;\n catalogOverride: string | undefined;\n lastSql: string | undefined;\n lastStatementId: string | undefined;\n stepOutputCapture: StepOutputCapture | undefined;\n lakebasePool:\n | { query<T extends Record<string, unknown>>(sql: string): Promise<{ rows: T[] }> }\n | undefined;\n private ctx: ExecutionContext | undefined;\n private activeCtx: ExecutionContext | undefined;\n private readonly cleanups: Cleanup[] = [];\n\n constructor(options: IWorldOptions<DatabricksWorldParameters>) {\n super(options);\n this.profile = resolveProfile();\n }\n\n async context(): Promise<ExecutionContext> {\n if (this.activeCtx) return this.activeCtx;\n if (!this.ctx) {\n const env = this.catalogOverride\n ? { ...process.env, DBX_TEST_CATALOG: this.catalogOverride }\n : process.env;\n this.ctx = await createExecutionContext({\n profile: this.profile,\n env,\n schema: this.schemaOverride ?? this.parameters.schema,\n onStatement: ({ sql, statementId }) => {\n this.lastSql = sql;\n this.lastStatementId = statementId;\n },\n });\n }\n return this.ctx;\n }\n\n /** Route subsequent steps through a scenario-owned secondary identity. */\n useExecutionContext(context: ExecutionContext): void {\n if (this.activeCtx) throw new Error('A secondary execution context is already active');\n this.activeCtx = context;\n this.addCleanup(async () => {\n await context.close();\n this.activeCtx = undefined;\n });\n }\n\n /** Register scenario-scoped cleanup. Cleanups run in reverse order. */\n addCleanup(cleanup: Cleanup): void {\n this.cleanups.push(cleanup);\n }\n\n /** Resolve runner userdata from worldParameters first, then DBX_TEST_USERDATA_* env. */\n userdata(name: string): string | number | boolean | undefined {\n const configured = this.parameters.userdata?.[name];\n if (configured !== undefined) return configured;\n return process.env[`DBX_TEST_USERDATA_${name.replace(/[^A-Za-z0-9]/g, '_').toUpperCase()}`];\n }\n\n scopeTo(catalog: string, schema: string): void {\n if (this.ctx) {\n throw new Error(\n 'Given catalog/schema must run before any step that touches the warehouse in the scenario',\n );\n }\n // Feature files stay portable and readable with illustrative names. A live\n // runner may redirect every scenario into its provisioned scratch scope.\n this.catalogOverride =\n this.profile === 'live' ? (process.env.DBX_TEST_CATALOG ?? catalog) : catalog;\n this.schemaOverride =\n this.profile === 'live' ? (process.env.DBX_TEST_SCHEMA ?? schema) : schema;\n }\n\n async dispose(): Promise<void> {\n this.stepOutputCapture?.stop();\n this.stepOutputCapture = undefined;\n const errors: unknown[] = [];\n for (const cleanup of this.cleanups.splice(0).reverse()) {\n try {\n await cleanup();\n } catch (error) {\n errors.push(error);\n }\n }\n try {\n await this.ctx?.close();\n } catch (error) {\n errors.push(error);\n }\n this.ctx = undefined;\n if (errors.length > 0) throw new AggregateError(errors, 'Scenario cleanup failed');\n }\n}\n","import type { TestProfile } from '@fabricorg/databricks-testkit';\n\n/**\n * Tags that require a live workspace (or a long budget). Scenarios carrying\n * any of them are skipped under the `local` profile — see ADR-0006.\n */\nexport const LIVE_ONLY_TAGS = [\n '@live',\n '@jobs',\n '@dlt',\n '@pipeline',\n '@autoloader',\n '@lakebase',\n '@slow',\n] as const;\n\n/** Returns a skip reason when the scenario cannot run under the given profile, else null. */\nexport function liveOnlyReason(tags: readonly string[], profile: TestProfile): string | null {\n if (profile === 'live') return null;\n const blocking = tags.filter((t) => (LIVE_ONLY_TAGS as readonly string[]).includes(t));\n if (blocking.length === 0) return null;\n return `requires a live workspace (${blocking.join(', ')}); running under DBX_TEST_PROFILE=local`;\n}\n","import type { TableFixture } from '@fabricorg/databricks-testkit';\n\nconst INT_RE = /^-?\\d+$/;\nconst FLOAT_RE = /^-?\\d+\\.\\d+$/;\nconst TIMESTAMP_RE = /^\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}(:\\d{2})?/;\nconst BOOL_RE = /^(true|false)$/i;\n\n/**\n * Turn a Gherkin data table (header row + string cells) into a TableFixture,\n * inferring portable column types from the values: BIGINT, DOUBLE,\n * TIMESTAMP, BOOLEAN, else STRING. Empty cells become NULL.\n */\nexport function inferFixture(table: string, raw: readonly (readonly string[])[]): TableFixture {\n if (raw.length < 2) {\n throw new Error(`Data table for ${table} needs a header row and at least one data row`);\n }\n const [header, ...body] = raw as [readonly string[], ...(readonly string[])[]];\n const types = header.map((_, col) => inferColumnType(body.map((row) => row[col] ?? '')));\n const schema = header.map((name, i) => `\"${name}\" ${types[i]}`).join(', ');\n const rows = body.map((row) => row.map((cell, i) => coerceCell(cell, types[i] ?? 'STRING')));\n return { table, schema, rows };\n}\n\n/** Coerce data-table string cells to typed values for row matching (no header row). */\nexport function coerceMatchRows(raw: readonly (readonly string[])[]): Record<string, unknown>[] {\n if (raw.length < 2) {\n throw new Error('Match table needs a header row and at least one data row');\n }\n const [header, ...body] = raw as [readonly string[], ...(readonly string[])[]];\n return body.map((row) => {\n const out: Record<string, unknown> = {};\n header.forEach((name, i) => {\n out[name] = coerceCell(row[i] ?? '', inferColumnType([row[i] ?? '']));\n });\n return out;\n });\n}\n\nfunction inferColumnType(cells: readonly string[]): string {\n const present = cells.filter((c) => c !== '');\n if (present.length === 0) return 'STRING';\n if (present.every((c) => INT_RE.test(c))) return 'BIGINT';\n if (present.every((c) => FLOAT_RE.test(c) || INT_RE.test(c))) return 'DOUBLE';\n if (present.every((c) => TIMESTAMP_RE.test(c))) return 'TIMESTAMP';\n if (present.every((c) => BOOL_RE.test(c))) return 'BOOLEAN';\n return 'STRING';\n}\n\nfunction coerceCell(cell: string, type: string): unknown {\n if (cell === '') return null;\n if (type === 'BIGINT' || type === 'DOUBLE') return Number(cell);\n if (type === 'BOOLEAN') return /^true$/i.test(cell);\n return cell;\n}\n","import { type DatabricksRestClient, waitForDatabricksRun } from '@fabric-harness/databricks';\nimport type { WorkspaceClientLike } from '@fabricorg/databricks-testkit';\n\nexport interface RunJobOptions {\n pollIntervalMs?: number;\n timeoutMs?: number;\n}\n\nexport interface JobRunResult {\n runId: number;\n lifeCycleState: string;\n resultState: string;\n run: Record<string, unknown>;\n}\n\n/** Resolve a job by numeric id or by exact name via /api/2.1/jobs/list. */\nexport async function resolveJobId(client: WorkspaceClientLike, nameOrId: string): Promise<number> {\n if (/^\\d+$/.test(nameOrId)) return Number(nameOrId);\n const response = await client.get<{ jobs?: { job_id: number; settings?: { name?: string } }[] }>(\n '/api/2.1/jobs/list',\n { name: nameOrId },\n );\n const match = (response.jobs ?? []).find((j) => j.settings?.name === nameOrId);\n if (!match) throw new Error(`No Databricks job named '${nameOrId}' found`);\n return match.job_id;\n}\n\n/** run-now a job and poll its run to a terminal state. */\nexport async function runJobToTerminal(\n client: WorkspaceClientLike,\n nameOrId: string,\n options: RunJobOptions = {},\n): Promise<JobRunResult> {\n const jobId = await resolveJobId(client, nameOrId);\n const submitted = await client.post<{ run_id: number }>('/api/2.1/jobs/run-now', {\n job_id: jobId,\n });\n const run = await waitForDatabricksRun(client as DatabricksRestClient, submitted.run_id, {\n pollIntervalMs: options.pollIntervalMs,\n timeoutMs: options.timeoutMs,\n });\n const state = (run as { state?: { life_cycle_state?: string; result_state?: string } }).state;\n return {\n runId: submitted.run_id,\n lifeCycleState: state?.life_cycle_state ?? 'UNKNOWN',\n resultState: state?.result_state ?? 'UNKNOWN',\n run,\n };\n}\n","import {\n type PollOptions,\n type WorkspaceClientLike,\n waitForPipelineUpdate,\n} from '@fabricorg/databricks-testkit';\n\nexport type PipelineWaitOptions = PollOptions;\n\n/** Resolve a DLT/Lakeflow pipeline by id or exact name via /api/2.0/pipelines. */\nexport async function resolvePipelineId(\n client: WorkspaceClientLike,\n nameOrId: string,\n): Promise<string> {\n if (/^[0-9a-f]{8}-[0-9a-f-]{27,}$/i.test(nameOrId)) return nameOrId;\n const response = await client.get<{ statuses?: { pipeline_id: string; name?: string }[] }>(\n '/api/2.0/pipelines',\n { filter: `name LIKE '${nameOrId}'` },\n );\n const match = (response.statuses ?? []).find((p) => p.name === nameOrId);\n if (!match) throw new Error(`No Databricks pipeline named '${nameOrId}' found`);\n return match.pipeline_id;\n}\n\n/** Start a pipeline update; returns the update id to poll. */\nexport async function startPipelineUpdate(\n client: WorkspaceClientLike,\n pipelineId: string,\n options: { fullRefresh?: boolean } = {},\n): Promise<string> {\n const response = await client.post<{ update_id: string }>(\n `/api/2.0/pipelines/${encodeURIComponent(pipelineId)}/updates`,\n { full_refresh: options.fullRefresh ?? false },\n );\n return response.update_id;\n}\n\n/** Poll an update to a terminal state; throws on timeout or non-COMPLETED terminal states. */\nexport { waitForPipelineUpdate };\n","import { execFile } from 'node:child_process';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nexport interface RunFeaturesOptions {\n /** Directory containing the cucumber config / features. */\n cwd: string;\n /** Extra CLI args, e.g. ['--tags', 'not @slow'] or ['features/foo.feature']. */\n args?: string[];\n /** Extra environment (merged over process.env). */\n env?: Record<string, string>;\n /** Load TypeScript support code via tsx (default true). */\n tsx?: boolean;\n timeoutMs?: number;\n}\n\nexport interface RunFeaturesResult {\n success: boolean;\n exitCode: number;\n output: string;\n}\n\n/**\n * Vitest bridge: run cucumber-js as a subprocess so feature suites can be\n * embedded in an existing vitest run (one CI entry point) without fighting\n * over cucumber's global step registry or vitest's module transforms.\n */\nexport async function runFeatures(options: RunFeaturesOptions): Promise<RunFeaturesResult> {\n const require = createRequire(import.meta.url);\n // The bin path is not in the package's exports map — resolve it relative\n // to package.json (which is exported).\n const pkgPath = require.resolve('@cucumber/cucumber/package.json');\n const pkg = require(pkgPath) as { bin: Record<string, string> };\n const bin = join(dirname(pkgPath), pkg.bin['cucumber-js'] ?? 'bin/cucumber.js');\n const env: NodeJS.ProcessEnv = { ...process.env, ...options.env };\n if (options.tsx ?? true) {\n const tsxImport = '--import tsx';\n env.NODE_OPTIONS = env.NODE_OPTIONS ? `${env.NODE_OPTIONS} ${tsxImport}` : tsxImport;\n }\n return new Promise((resolve) => {\n execFile(\n process.execPath,\n [bin, ...(options.args ?? [])],\n { cwd: options.cwd, env, timeout: options.timeoutMs ?? 120_000, maxBuffer: 16 * 1024 * 1024 },\n (error, stdout, stderr) => {\n const exitCode =\n error && typeof (error as { code?: unknown }).code === 'number'\n ? ((error as { code?: number }).code ?? 1)\n : error\n ? 1\n : 0;\n resolve({ success: exitCode === 0, exitCode, output: `${stdout}\\n${stderr}` });\n },\n );\n });\n}\n","import { defineParameterType } from '@cucumber/cucumber';\n\nexport const RUN_STATES = ['SUCCESS', 'FAILED', 'CANCELED', 'TIMEDOUT'] as const;\nexport type RunState = (typeof RUN_STATES)[number];\n\nexport function parseDuration(value: string): number {\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?)\\s*(milliseconds?|ms|seconds?|s|minutes?|m)$/i);\n if (!match) throw new Error(`Invalid duration '${value}'`);\n const amount = Number(match[1]);\n const unit = match[2]?.toLowerCase() ?? '';\n if (unit === 'ms' || unit.startsWith('millisecond')) return amount;\n if (unit === 's' || unit.startsWith('second')) return amount * 1_000;\n return amount * 60_000;\n}\n\nexport function parseTableIdentifier(value: string): string {\n const identifier = value.trim();\n const part = '(?:[A-Za-z_][A-Za-z0-9_]*|`[^`]+`)';\n if (!new RegExp(`^${part}(?:\\\\.${part}){0,2}$`).test(identifier)) {\n throw new Error(`Invalid 1-3 part table identifier '${value}'`);\n }\n return identifier;\n}\n\nexport function registerParameterTypes(): void {\n defineParameterType({\n name: 'runState',\n regexp: /SUCCESS|FAILED|CANCELED|TIMEDOUT/,\n transformer: (value: string): RunState => value as RunState,\n });\n\n defineParameterType({\n name: 'duration',\n regexp: /\\d+(?:\\.\\d+)?\\s*(?:milliseconds?|ms|seconds?|s|minutes?|m)/,\n transformer: parseDuration,\n });\n\n defineParameterType({\n name: 'table',\n regexp: /(?:[A-Za-z_][A-Za-z0-9_]*|`[^`]+`)(?:\\.(?:[A-Za-z_][A-Za-z0-9_]*|`[^`]+`)){0,2}/,\n transformer: parseTableIdentifier,\n });\n}\n","import { Formatter, type IFormatterOptions } from '@cucumber/cucumber';\n\n/**\n * Evidence formatter: schema-versioned, secret-redacted JSON summary of a\n * BDD run, shared in spirit with the live check runner's evidence output so\n * nightly runs double as audit artifacts. Wire it up in cucumber config:\n *\n * format: [['@fabricorg/databricks-bdd/evidence-formatter', 'reports/evidence.json']]\n */\nexport interface EvidenceScenario {\n name: string;\n uri: string;\n tags: string[];\n status: string;\n durationMs: number;\n error?: string;\n failures?: StepFailureEvidence[];\n}\n\nexport interface StepFailureEvidence {\n step: string;\n statementId?: string;\n sql?: string;\n output?: string;\n outputBytes?: number;\n outputTruncated?: boolean;\n}\n\nexport interface EvidenceReport {\n schemaVersion: 2;\n kind: 'databricks-bdd';\n profile: string;\n finishedAt: string;\n success: boolean;\n summary: Record<string, number>;\n scenarios: EvidenceScenario[];\n}\n\ninterface Envelope {\n attachment?: {\n body: string;\n contentEncoding: 'IDENTITY' | 'BASE64';\n mediaType: string;\n testCaseStartedId?: string;\n };\n pickle?: { id: string; name: string; uri: string; tags?: { name: string }[] };\n testCase?: { id: string; pickleId: string };\n testCaseStarted?: { id: string; testCaseId: string };\n testStepFinished?: {\n testCaseStartedId: string;\n testStepResult: {\n status: string;\n message?: string;\n duration?: { seconds: number; nanos: number };\n };\n };\n testRunFinished?: { success?: boolean; timestamp?: { seconds: number; nanos: number } };\n}\n\nexport const FAILURE_EVIDENCE_MEDIA_TYPE = 'application/vnd.fabric.databricks-bdd.failure+json';\n\nconst STATUS_RANK = ['UNKNOWN', 'PASSED', 'SKIPPED', 'PENDING', 'UNDEFINED', 'AMBIGUOUS', 'FAILED'];\n\nexport default class EvidenceFormatter extends Formatter {\n private readonly pickles = new Map<string, NonNullable<Envelope['pickle']>>();\n private readonly testCases = new Map<string, string>(); // testCaseId → pickleId\n private readonly attempts = new Map<\n string,\n {\n pickleId: string;\n status: string;\n durationMs: number;\n error?: string;\n failures: StepFailureEvidence[];\n }\n >();\n\n constructor(options: IFormatterOptions) {\n super(options);\n options.eventBroadcaster.on('envelope', (envelope: Envelope) => this.onEnvelope(envelope));\n }\n\n private onEnvelope(envelope: Envelope): void {\n if (envelope.pickle) this.pickles.set(envelope.pickle.id, envelope.pickle);\n if (envelope.testCase) this.testCases.set(envelope.testCase.id, envelope.testCase.pickleId);\n if (envelope.testCaseStarted) {\n this.attempts.set(envelope.testCaseStarted.id, {\n pickleId: this.testCases.get(envelope.testCaseStarted.testCaseId) ?? '',\n status: 'UNKNOWN',\n durationMs: 0,\n failures: [],\n });\n }\n if (envelope.attachment?.testCaseStartedId) {\n const attempt = this.attempts.get(envelope.attachment.testCaseStartedId);\n const failure = parseFailureEvidenceAttachment(envelope.attachment);\n if (attempt && failure) attempt.failures.push(failure);\n }\n if (envelope.testStepFinished) {\n const attempt = this.attempts.get(envelope.testStepFinished.testCaseStartedId);\n if (attempt) {\n const result = envelope.testStepFinished.testStepResult;\n if (STATUS_RANK.indexOf(result.status) > STATUS_RANK.indexOf(attempt.status)) {\n attempt.status = result.status;\n if (result.message) attempt.error = redactSecrets(result.message);\n }\n const d = result.duration;\n if (d) attempt.durationMs += d.seconds * 1000 + d.nanos / 1e6;\n }\n }\n if (envelope.testRunFinished) this.finish(envelope.testRunFinished);\n }\n\n private finish(finished: NonNullable<Envelope['testRunFinished']>): void {\n const scenarios: EvidenceScenario[] = [];\n const summary: Record<string, number> = {};\n for (const attempt of this.attempts.values()) {\n const pickle = this.pickles.get(attempt.pickleId);\n const status = attempt.status.toLowerCase();\n summary[status] = (summary[status] ?? 0) + 1;\n scenarios.push({\n name: pickle?.name ?? attempt.pickleId,\n uri: pickle?.uri ?? '',\n tags: (pickle?.tags ?? []).map((t) => t.name),\n status,\n durationMs: Math.round(attempt.durationMs),\n ...(attempt.error ? { error: attempt.error } : {}),\n ...(attempt.failures.length > 0 ? { failures: attempt.failures } : {}),\n });\n }\n const report: EvidenceReport = {\n schemaVersion: 2,\n kind: 'databricks-bdd',\n profile: process.env.DBX_TEST_PROFILE ?? 'local',\n finishedAt: new Date().toISOString(),\n success: finished.success ?? !scenarios.some((s) => s.status === 'failed'),\n summary,\n scenarios,\n };\n this.log(`${JSON.stringify(report, null, 2)}\\n`);\n }\n}\n\n/** Decode the structured attachment emitted by the failure hook. */\nexport function parseFailureEvidenceAttachment(\n attachment: NonNullable<Envelope['attachment']>,\n): StepFailureEvidence | null {\n if (attachment.mediaType !== FAILURE_EVIDENCE_MEDIA_TYPE) return null;\n try {\n const body =\n attachment.contentEncoding === 'BASE64'\n ? Buffer.from(attachment.body, 'base64').toString('utf8')\n : attachment.body;\n const parsed = JSON.parse(redactSecrets(body)) as Partial<StepFailureEvidence>;\n if (typeof parsed.step !== 'string') return null;\n return {\n step: parsed.step,\n ...(typeof parsed.statementId === 'string' ? { statementId: parsed.statementId } : {}),\n ...(typeof parsed.sql === 'string' ? { sql: parsed.sql } : {}),\n ...(typeof parsed.output === 'string' ? { output: parsed.output } : {}),\n ...(typeof parsed.outputBytes === 'number' ? { outputBytes: parsed.outputBytes } : {}),\n ...(typeof parsed.outputTruncated === 'boolean'\n ? { outputTruncated: parsed.outputTruncated }\n : {}),\n };\n } catch {\n return null;\n }\n}\n\nconst SECRET_ENV_RE = /(TOKEN|SECRET|PASSWORD|BEARER|KEY)/;\n\n/** Replace values of secret-looking env vars anywhere they appear in text. */\nexport function redactSecrets(\n text: string,\n env: Record<string, string | undefined> = process.env,\n): string {\n let out = text;\n for (const [name, value] of Object.entries(env)) {\n if (!value || value.length < 6) continue;\n if (!SECRET_ENV_RE.test(name)) continue;\n out = out.split(value).join('[REDACTED]');\n }\n return out;\n}\n","import type { Writable } from 'node:stream';\nimport { format } from 'node:util';\n\nexport type CapturedStream = 'stdout' | 'stderr';\n\nexport interface CapturedStepOutput {\n /** Ordered stdout/stderr output with stream labels. */\n text: string;\n /** True when output exceeded the configured byte budget. */\n truncated: boolean;\n /** Total bytes emitted before truncation. */\n totalBytes: number;\n}\n\nexport interface StepOutputCapture {\n stop(): CapturedStepOutput;\n}\n\nexport interface StepOutputCaptureOptions {\n /** Maximum UTF-8 bytes retained for one step. Defaults to 32 KiB. */\n maxBytes?: number;\n /** Forward output while capturing. Defaults to false, matching Behave capture semantics. */\n passthrough?: boolean;\n}\n\ninterface CapturedChunk {\n stream: CapturedStream;\n text: string;\n}\n\ntype Write = Writable['write'];\ntype ConsoleMethod = 'debug' | 'error' | 'info' | 'log' | 'warn';\n\nconst DEFAULT_MAX_BYTES = 32 * 1024;\n\n/**\n * Capture process stdout/stderr until stop() is called. Console output and\n * Pino's standard destination both flow through these streams. Child\n * processes that inherit the OS file descriptors directly are intentionally\n * outside this in-process capture boundary.\n */\nexport function startStepOutputCapture(options: StepOutputCaptureOptions = {}): StepOutputCapture {\n const maxBytes = Math.max(0, options.maxBytes ?? DEFAULT_MAX_BYTES);\n const stdout = process.stdout;\n const stderr = process.stderr;\n const originalStdoutWrite = stdout.write;\n const originalStderrWrite = stderr.write;\n const originalConsole = Object.fromEntries(\n (['debug', 'error', 'info', 'log', 'warn'] as const).map((method) => [method, console[method]]),\n ) as Record<ConsoleMethod, typeof console.log>;\n const chunks: CapturedChunk[] = [];\n let retainedBytes = 0;\n let totalBytes = 0;\n let stopped = false;\n\n const capture = (stream: CapturedStream, chunk: unknown): void => {\n const text = chunkToString(chunk);\n const bytes = Buffer.byteLength(text);\n totalBytes += bytes;\n const remaining = maxBytes - retainedBytes;\n if (remaining <= 0 || bytes === 0) return;\n const retained = bytes <= remaining ? text : truncateUtf8(text, remaining);\n retainedBytes += Buffer.byteLength(retained);\n if (retained) chunks.push({ stream, text: retained });\n };\n\n stdout.write = interceptedWrite(\n stdout,\n 'stdout',\n originalStdoutWrite,\n capture,\n options.passthrough,\n );\n stderr.write = interceptedWrite(\n stderr,\n 'stderr',\n originalStderrWrite,\n capture,\n options.passthrough,\n );\n if (!options.passthrough) {\n for (const method of ['debug', 'info', 'log'] as const) {\n console[method] = (...args: unknown[]) => capture('stdout', `${format(...args)}\\n`);\n }\n for (const method of ['error', 'warn'] as const) {\n console[method] = (...args: unknown[]) => capture('stderr', `${format(...args)}\\n`);\n }\n }\n\n return {\n stop(): CapturedStepOutput {\n if (!stopped) {\n stdout.write = originalStdoutWrite;\n stderr.write = originalStderrWrite;\n for (const method of Object.keys(originalConsole) as ConsoleMethod[]) {\n console[method] = originalConsole[method];\n }\n stopped = true;\n }\n return {\n text: renderChunks(chunks),\n truncated: totalBytes > retainedBytes,\n totalBytes,\n };\n },\n };\n}\n\nfunction interceptedWrite(\n destination: Writable,\n stream: CapturedStream,\n original: Write,\n capture: (stream: CapturedStream, chunk: unknown) => void,\n passthrough = false,\n): Write {\n return function write(chunk: unknown, encodingOrCallback?: unknown, callback?: unknown): boolean {\n capture(stream, chunk);\n if (passthrough) {\n return original.call(\n destination,\n chunk as never,\n encodingOrCallback as never,\n callback as never,\n );\n }\n const done = typeof encodingOrCallback === 'function' ? encodingOrCallback : callback;\n if (typeof done === 'function') queueMicrotask(() => done());\n return true;\n } as Write;\n}\n\nfunction chunkToString(chunk: unknown): string {\n if (typeof chunk === 'string') return chunk;\n if (Buffer.isBuffer(chunk)) return chunk.toString('utf8');\n if (chunk instanceof Uint8Array) return Buffer.from(chunk).toString('utf8');\n return String(chunk);\n}\n\nfunction truncateUtf8(value: string, maxBytes: number): string {\n return Buffer.from(value)\n .subarray(0, maxBytes)\n .toString('utf8')\n .replace(/\\uFFFD$/u, '');\n}\n\nfunction renderChunks(chunks: readonly CapturedChunk[]): string {\n let rendered = '';\n let previous: CapturedStream | undefined;\n for (const chunk of chunks) {\n if (chunk.stream !== previous) {\n if (rendered && !rendered.endsWith('\\n')) rendered += '\\n';\n rendered += `[${chunk.stream}]\\n`;\n previous = chunk.stream;\n }\n rendered += chunk.text;\n }\n return rendered.trimEnd();\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/fixtures.ts","../src/world.ts","../src/profile.ts","../src/infer.ts","../src/jobs.ts","../src/pipelines.ts","../src/run-features.ts","../src/parameter-types.ts","../src/evidence-formatter.ts","../src/output-capture.ts"],"names":["World","resolveProfile","createExecutionContext","waitForDatabricksRun","require","createRequire","join","dirname","execFile","format"],"mappings":";;;;;;;;;;;;;;AA2BA,SAAS,gBAAmB,KAAA,EAG1B;AACA,EAAA,OACE,OAAO,KAAA,KAAU,QAAA,IACjB,KAAA,KAAU,QACV,MAAA,CAAO,SAAA,CAAU,cAAA,CAAe,IAAA,CAAK,KAAA,EAAO,OAAO,CAAA,IACnD,OAAQ,MAAgC,OAAA,KAAY,UAAA;AAExD;AAEO,IAAM,wBAAN,MAA4B;AAAA,EAChB,UAAA,uBAAiB,GAAA,EAA0B;AAAA,EAC3C,cAAA,uBAAqB,GAAA,EAAuC;AAAA,EAC5D,eAA+B,EAAC;AAAA,EAEjD,UAAA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M,CAAA;AAC1E,EAAA,OAAO,OAAO,KAAK,CAAA;AACrB;AAEA,SAAS,YAAA,CAAa,OAAe,QAAA,EAA0B;AAC7D,EAAA,OAAO,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CACrB,QAAA,CAAS,CAAA,EAAG,QAAQ,CAAA,CACpB,QAAA,CAAS,MAAM,CAAA,CACf,OAAA,CAAQ,YAAY,EAAE,CAAA;AAC3B;AAEA,SAAS,aAAa,MAAA,EAA0C;AAC9D,EAAA,IAAI,QAAA,GAAW,EAAA;AACf,EAAA,IAAI,QAAA;AACJ,EAAA,KAAA,MAAW,SAAS,MAAA,EAAQ;AAC1B,IAAA,IAAI,KAAA,CAAM,WAAW,QAAA,EAAU;AAC7B,MAAA,IAAI,YAAY,CAAC,QAAA,CAAS,QAAA,CAAS,IAAI,GAAG,QAAA,IAAY,IAAA;AACtD,MAAA,QAAA,IAAY,CAAA,CAAA,EAAI,MAAM,MAAM,CAAA;AAAA,CAAA;AAC5B,MAAA,QAAA,GAAW,KAAA,CAAM,MAAA;AAAA,IACnB;AACA,IAAA,QAAA,IAAY,KAAA,CAAM,IAAA;AAAA,EACpB;AACA,EAAA,OAAO,SAAS,OAAA,EAAQ;AAC1B","file":"index.cjs","sourcesContent":["/**\n * Behave-style shared fixtures for expensive Databricks resources.\n *\n * Cucumber Worlds are scenario-scoped. These registries provide the two\n * broader scopes users commonly need when migrating Behave suites:\n *\n * - runFixture: setup once for the entire Cucumber run;\n * - featureFixture: setup once per feature URI.\n *\n * Both scopes are drained by the package AfterAll hook. Deferring feature\n * cleanup until AfterAll is intentional: cucumber-js may interleave scenarios\n * and does not expose an after-feature hook. The resource is still isolated by\n * feature URI and is never reused by another feature.\n */\n\nexport type FixtureCleanup = () => void | Promise<void>;\nexport type FixtureSetup<T> = () =>\n | T\n | Promise<T>\n | { value: T; cleanup: FixtureCleanup }\n | Promise<{ value: T; cleanup: FixtureCleanup }>;\n\ninterface FixtureEntry<T = unknown> {\n value: Promise<T>;\n cleanup?: FixtureCleanup;\n}\n\nfunction isFixtureResult<T>(value: T | { value: T; cleanup: FixtureCleanup }): value is {\n value: T;\n cleanup: FixtureCleanup;\n} {\n return (\n typeof value === 'object' &&\n value !== null &&\n Object.prototype.hasOwnProperty.call(value, 'value') &&\n typeof (value as { cleanup?: unknown }).cleanup === 'function'\n );\n}\n\nexport class SharedFixtureRegistry {\n private readonly runEntries = new Map<string, FixtureEntry>();\n private readonly featureEntries = new Map<string, Map<string, FixtureEntry>>();\n private readonly cleanupOrder: FixtureEntry[] = [];\n\n runFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T> {\n return this.resolve(this.runEntries, key, setup);\n }\n\n featureFixture<T>(featureUri: string, key: string, setup: FixtureSetup<T>): Promise<T> {\n if (!featureUri) throw new Error('featureFixture requires a feature URI');\n let feature = this.featureEntries.get(featureUri);\n if (!feature) {\n feature = new Map();\n this.featureEntries.set(featureUri, feature);\n }\n return this.resolve(feature, key, setup);\n }\n\n private resolve<T>(entries: Map<string, FixtureEntry>, key: string, setup: FixtureSetup<T>) {\n if (!key.trim()) throw new Error('Fixture key must not be empty');\n const existing = entries.get(key);\n if (existing) return existing.value as Promise<T>;\n\n const entry: FixtureEntry<T> = {\n value: Promise.resolve()\n .then(setup)\n .then((result) => {\n if (isFixtureResult(result)) {\n entry.cleanup = result.cleanup;\n return result.value;\n }\n return result;\n })\n .catch((error) => {\n entries.delete(key);\n const index = this.cleanupOrder.indexOf(entry);\n if (index >= 0) this.cleanupOrder.splice(index, 1);\n throw error;\n }),\n };\n entries.set(key, entry);\n this.cleanupOrder.push(entry);\n return entry.value;\n }\n\n async dispose(): Promise<void> {\n const errors: unknown[] = [];\n for (const entry of this.cleanupOrder.splice(0).reverse()) {\n try {\n // Ensure setup has settled before attempting its cleanup.\n await entry.value.catch(() => undefined);\n await entry.cleanup?.();\n } catch (error) {\n errors.push(error);\n }\n }\n this.runEntries.clear();\n this.featureEntries.clear();\n if (errors.length > 0) throw new AggregateError(errors, 'Shared fixture cleanup failed');\n }\n}\n\nexport const sharedFixtures = new SharedFixtureRegistry();\n","import { type IWorldOptions, World } from '@cucumber/cucumber';\nimport {\n type ExecutionContext,\n type TestProfile,\n createExecutionContext,\n resolveProfile,\n} from '@fabricorg/databricks-testkit';\nimport { type FixtureSetup, sharedFixtures } from './fixtures.js';\nimport type { StepOutputCapture } from './output-capture.js';\n\nexport interface DatabricksWorldParameters {\n /** Default schema for the execution context; overridable per scenario via the catalog/schema step. */\n schema?: string;\n /** Arbitrary typed runner configuration, comparable to behave `-D` userdata. */\n userdata?: Record<string, string | number | boolean>;\n}\n\ntype Cleanup = () => void | Promise<void>;\n\n/**\n * Cucumber World holding one ExecutionContext per scenario. The context is\n * created lazily on first use so `Given catalog ... and schema ...` can run\n * first; it is closed by the After hook registered in ./steps.ts.\n */\nexport class DatabricksWorld extends World<DatabricksWorldParameters> {\n readonly profile: TestProfile;\n /** Rows from the last `When I run the SQL` / `When I query table` step. */\n lastRows: Record<string, unknown>[] | null = null;\n /** Error captured from the last statement, for `Then the statement fails ...`. */\n lastError: Error | null = null;\n /** Terminal run record from the last `When I run job ...` step. */\n lastRun: Record<string, unknown> | null = null;\n /** Pipeline update handle from `When I start a full refresh of pipeline ...`. */\n lastPipelineUpdate: { pipelineId: string; updateId: string } | null = null;\n schemaOverride: string | undefined;\n catalogOverride: string | undefined;\n lastSql: string | undefined;\n lastStatementId: string | undefined;\n featureUri: string | undefined;\n stepOutputCapture: StepOutputCapture | undefined;\n lakebasePool:\n | { query<T extends Record<string, unknown>>(sql: string): Promise<{ rows: T[] }> }\n | undefined;\n private ctx: ExecutionContext | undefined;\n private activeCtx: ExecutionContext | undefined;\n private readonly cleanups: Cleanup[] = [];\n\n constructor(options: IWorldOptions<DatabricksWorldParameters>) {\n super(options);\n this.profile = resolveProfile();\n }\n\n async context(): Promise<ExecutionContext> {\n if (this.activeCtx) return this.activeCtx;\n if (!this.ctx) {\n const env = this.catalogOverride\n ? { ...process.env, DBX_TEST_CATALOG: this.catalogOverride }\n : process.env;\n this.ctx = await createExecutionContext({\n profile: this.profile,\n env,\n schema: this.schemaOverride ?? this.parameters.schema,\n onStatement: ({ sql, statementId }) => {\n this.lastSql = sql;\n this.lastStatementId = statementId;\n },\n });\n }\n return this.ctx;\n }\n\n /** Route subsequent steps through a scenario-owned secondary identity. */\n useExecutionContext(context: ExecutionContext): void {\n if (this.activeCtx) throw new Error('A secondary execution context is already active');\n this.activeCtx = context;\n this.addCleanup(async () => {\n await context.close();\n this.activeCtx = undefined;\n });\n }\n\n /** Register scenario-scoped cleanup. Cleanups run in reverse order. */\n addCleanup(cleanup: Cleanup): void {\n this.cleanups.push(cleanup);\n }\n\n /** Setup a resource once for this Cucumber run and clean it up in AfterAll. */\n runFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T> {\n return sharedFixtures.runFixture(key, setup);\n }\n\n /**\n * Setup a resource once per feature file. It is isolated by feature URI and\n * cleaned in AfterAll because cucumber-js has no reliable after-feature hook.\n */\n featureFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T> {\n if (!this.featureUri) {\n throw new Error('featureFixture is only available after the scenario Before hook');\n }\n return sharedFixtures.featureFixture(this.featureUri, key, setup);\n }\n\n /** Resolve runner userdata from worldParameters first, then DBX_TEST_USERDATA_* env. */\n userdata(name: string): string | number | boolean | undefined {\n const configured = this.parameters.userdata?.[name];\n if (configured !== undefined) return configured;\n return process.env[`DBX_TEST_USERDATA_${name.replace(/[^A-Za-z0-9]/g, '_').toUpperCase()}`];\n }\n\n scopeTo(catalog: string, schema: string): void {\n if (this.ctx) {\n throw new Error(\n 'Given catalog/schema must run before any step that touches the warehouse in the scenario',\n );\n }\n // Feature files stay portable and readable with illustrative names. A live\n // runner may redirect every scenario into its provisioned scratch scope.\n this.catalogOverride =\n this.profile === 'live' ? (process.env.DBX_TEST_CATALOG ?? catalog) : catalog;\n this.schemaOverride =\n this.profile === 'live' ? (process.env.DBX_TEST_SCHEMA ?? schema) : schema;\n }\n\n async dispose(): Promise<void> {\n this.stepOutputCapture?.stop();\n this.stepOutputCapture = undefined;\n const errors: unknown[] = [];\n for (const cleanup of this.cleanups.splice(0).reverse()) {\n try {\n await cleanup();\n } catch (error) {\n errors.push(error);\n }\n }\n try {\n await this.ctx?.close();\n } catch (error) {\n errors.push(error);\n }\n this.ctx = undefined;\n if (errors.length > 0) throw new AggregateError(errors, 'Scenario cleanup failed');\n }\n}\n","import type { TestProfile } from '@fabricorg/databricks-testkit';\n\n/**\n * Tags that require a live workspace (or a long budget). Scenarios carrying\n * any of them are skipped under the `local` profile — see ADR-0006.\n */\nexport const LIVE_ONLY_TAGS = [\n '@live',\n '@jobs',\n '@dlt',\n '@pipeline',\n '@autoloader',\n '@lakebase',\n '@slow',\n] as const;\n\n/** Returns a skip reason when the scenario cannot run under the given profile, else null. */\nexport function liveOnlyReason(tags: readonly string[], profile: TestProfile): string | null {\n if (profile === 'live') return null;\n const blocking = tags.filter((t) => (LIVE_ONLY_TAGS as readonly string[]).includes(t));\n if (blocking.length === 0) return null;\n return `requires a live workspace (${blocking.join(', ')}); running under DBX_TEST_PROFILE=local`;\n}\n","import type { TableFixture } from '@fabricorg/databricks-testkit';\n\nconst INT_RE = /^-?\\d+$/;\nconst FLOAT_RE = /^-?\\d+\\.\\d+$/;\nconst TIMESTAMP_RE = /^\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}(:\\d{2})?/;\nconst BOOL_RE = /^(true|false)$/i;\n\n/**\n * Turn a Gherkin data table (header row + string cells) into a TableFixture,\n * inferring portable column types from the values: BIGINT, DOUBLE,\n * TIMESTAMP, BOOLEAN, else STRING. Empty cells become NULL.\n */\nexport function inferFixture(table: string, raw: readonly (readonly string[])[]): TableFixture {\n if (raw.length < 2) {\n throw new Error(`Data table for ${table} needs a header row and at least one data row`);\n }\n const [header, ...body] = raw as [readonly string[], ...(readonly string[])[]];\n const types = header.map((_, col) => inferColumnType(body.map((row) => row[col] ?? '')));\n const schema = header.map((name, i) => `\"${name}\" ${types[i]}`).join(', ');\n const rows = body.map((row) => row.map((cell, i) => coerceCell(cell, types[i] ?? 'STRING')));\n return { table, schema, rows };\n}\n\n/** Coerce data-table string cells to typed values for row matching (no header row). */\nexport function coerceMatchRows(raw: readonly (readonly string[])[]): Record<string, unknown>[] {\n if (raw.length < 2) {\n throw new Error('Match table needs a header row and at least one data row');\n }\n const [header, ...body] = raw as [readonly string[], ...(readonly string[])[]];\n return body.map((row) => {\n const out: Record<string, unknown> = {};\n header.forEach((name, i) => {\n out[name] = coerceCell(row[i] ?? '', inferColumnType([row[i] ?? '']));\n });\n return out;\n });\n}\n\nfunction inferColumnType(cells: readonly string[]): string {\n const present = cells.filter((c) => c !== '');\n if (present.length === 0) return 'STRING';\n if (present.every((c) => INT_RE.test(c))) return 'BIGINT';\n if (present.every((c) => FLOAT_RE.test(c) || INT_RE.test(c))) return 'DOUBLE';\n if (present.every((c) => TIMESTAMP_RE.test(c))) return 'TIMESTAMP';\n if (present.every((c) => BOOL_RE.test(c))) return 'BOOLEAN';\n return 'STRING';\n}\n\nfunction coerceCell(cell: string, type: string): unknown {\n if (cell === '') return null;\n if (type === 'BIGINT' || type === 'DOUBLE') return Number(cell);\n if (type === 'BOOLEAN') return /^true$/i.test(cell);\n return cell;\n}\n","import { type DatabricksRestClient, waitForDatabricksRun } from '@fabric-harness/databricks';\nimport type { WorkspaceClientLike } from '@fabricorg/databricks-testkit';\n\nexport interface RunJobOptions {\n pollIntervalMs?: number;\n timeoutMs?: number;\n}\n\nexport interface JobRunResult {\n runId: number;\n lifeCycleState: string;\n resultState: string;\n run: Record<string, unknown>;\n}\n\n/** Resolve a job by numeric id or by exact name via /api/2.1/jobs/list. */\nexport async function resolveJobId(client: WorkspaceClientLike, nameOrId: string): Promise<number> {\n if (/^\\d+$/.test(nameOrId)) return Number(nameOrId);\n const response = await client.get<{ jobs?: { job_id: number; settings?: { name?: string } }[] }>(\n '/api/2.1/jobs/list',\n { name: nameOrId },\n );\n const match = (response.jobs ?? []).find((j) => j.settings?.name === nameOrId);\n if (!match) throw new Error(`No Databricks job named '${nameOrId}' found`);\n return match.job_id;\n}\n\n/** run-now a job and poll its run to a terminal state. */\nexport async function runJobToTerminal(\n client: WorkspaceClientLike,\n nameOrId: string,\n options: RunJobOptions = {},\n): Promise<JobRunResult> {\n const jobId = await resolveJobId(client, nameOrId);\n const submitted = await client.post<{ run_id: number }>('/api/2.1/jobs/run-now', {\n job_id: jobId,\n });\n const run = await waitForDatabricksRun(client as DatabricksRestClient, submitted.run_id, {\n pollIntervalMs: options.pollIntervalMs,\n timeoutMs: options.timeoutMs,\n });\n const state = (run as { state?: { life_cycle_state?: string; result_state?: string } }).state;\n return {\n runId: submitted.run_id,\n lifeCycleState: state?.life_cycle_state ?? 'UNKNOWN',\n resultState: state?.result_state ?? 'UNKNOWN',\n run,\n };\n}\n","import {\n type PollOptions,\n type WorkspaceClientLike,\n waitForPipelineUpdate,\n} from '@fabricorg/databricks-testkit';\n\nexport type PipelineWaitOptions = PollOptions;\n\n/** Resolve a DLT/Lakeflow pipeline by id or exact name via /api/2.0/pipelines. */\nexport async function resolvePipelineId(\n client: WorkspaceClientLike,\n nameOrId: string,\n): Promise<string> {\n if (/^[0-9a-f]{8}-[0-9a-f-]{27,}$/i.test(nameOrId)) return nameOrId;\n const response = await client.get<{ statuses?: { pipeline_id: string; name?: string }[] }>(\n '/api/2.0/pipelines',\n { filter: `name LIKE '${nameOrId}'` },\n );\n const match = (response.statuses ?? []).find((p) => p.name === nameOrId);\n if (!match) throw new Error(`No Databricks pipeline named '${nameOrId}' found`);\n return match.pipeline_id;\n}\n\n/** Start a pipeline update; returns the update id to poll. */\nexport async function startPipelineUpdate(\n client: WorkspaceClientLike,\n pipelineId: string,\n options: { fullRefresh?: boolean } = {},\n): Promise<string> {\n const response = await client.post<{ update_id: string }>(\n `/api/2.0/pipelines/${encodeURIComponent(pipelineId)}/updates`,\n { full_refresh: options.fullRefresh ?? false },\n );\n return response.update_id;\n}\n\n/** Poll an update to a terminal state; throws on timeout or non-COMPLETED terminal states. */\nexport { waitForPipelineUpdate };\n","import { execFile } from 'node:child_process';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nexport interface RunFeaturesOptions {\n /** Directory containing the cucumber config / features. */\n cwd: string;\n /** Extra CLI args, e.g. ['--tags', 'not @slow'] or ['features/foo.feature']. */\n args?: string[];\n /** Extra environment (merged over process.env). */\n env?: Record<string, string>;\n /** Load TypeScript support code via tsx (default true). */\n tsx?: boolean;\n timeoutMs?: number;\n}\n\nexport interface RunFeaturesResult {\n success: boolean;\n exitCode: number;\n output: string;\n}\n\n/**\n * Vitest bridge: run cucumber-js as a subprocess so feature suites can be\n * embedded in an existing vitest run (one CI entry point) without fighting\n * over cucumber's global step registry or vitest's module transforms.\n */\nexport async function runFeatures(options: RunFeaturesOptions): Promise<RunFeaturesResult> {\n const require = createRequire(import.meta.url);\n // The bin path is not in the package's exports map — resolve it relative\n // to package.json (which is exported).\n const pkgPath = require.resolve('@cucumber/cucumber/package.json');\n const pkg = require(pkgPath) as { bin: Record<string, string> };\n const bin = join(dirname(pkgPath), pkg.bin['cucumber-js'] ?? 'bin/cucumber.js');\n const env: NodeJS.ProcessEnv = { ...process.env, ...options.env };\n if (options.tsx ?? true) {\n const tsxImport = '--import tsx';\n env.NODE_OPTIONS = env.NODE_OPTIONS ? `${env.NODE_OPTIONS} ${tsxImport}` : tsxImport;\n }\n return new Promise((resolve) => {\n execFile(\n process.execPath,\n [bin, ...(options.args ?? [])],\n { cwd: options.cwd, env, timeout: options.timeoutMs ?? 120_000, maxBuffer: 16 * 1024 * 1024 },\n (error, stdout, stderr) => {\n const exitCode =\n error && typeof (error as { code?: unknown }).code === 'number'\n ? ((error as { code?: number }).code ?? 1)\n : error\n ? 1\n : 0;\n resolve({ success: exitCode === 0, exitCode, output: `${stdout}\\n${stderr}` });\n },\n );\n });\n}\n","import { defineParameterType } from '@cucumber/cucumber';\n\nexport const RUN_STATES = ['SUCCESS', 'FAILED', 'CANCELED', 'TIMEDOUT'] as const;\nexport type RunState = (typeof RUN_STATES)[number];\n\nexport function parseDuration(value: string): number {\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?)\\s*(milliseconds?|ms|seconds?|s|minutes?|m)$/i);\n if (!match) throw new Error(`Invalid duration '${value}'`);\n const amount = Number(match[1]);\n const unit = match[2]?.toLowerCase() ?? '';\n if (unit === 'ms' || unit.startsWith('millisecond')) return amount;\n if (unit === 's' || unit.startsWith('second')) return amount * 1_000;\n return amount * 60_000;\n}\n\nexport function parseTableIdentifier(value: string): string {\n const identifier = value.trim();\n const part = '(?:[A-Za-z_][A-Za-z0-9_]*|`[^`]+`)';\n if (!new RegExp(`^${part}(?:\\\\.${part}){0,2}$`).test(identifier)) {\n throw new Error(`Invalid 1-3 part table identifier '${value}'`);\n }\n return identifier;\n}\n\nexport function registerParameterTypes(): void {\n defineParameterType({\n name: 'runState',\n regexp: /SUCCESS|FAILED|CANCELED|TIMEDOUT/,\n transformer: (value: string): RunState => value as RunState,\n });\n\n defineParameterType({\n name: 'duration',\n regexp: /\\d+(?:\\.\\d+)?\\s*(?:milliseconds?|ms|seconds?|s|minutes?|m)/,\n transformer: parseDuration,\n });\n\n defineParameterType({\n name: 'table',\n regexp: /(?:[A-Za-z_][A-Za-z0-9_]*|`[^`]+`)(?:\\.(?:[A-Za-z_][A-Za-z0-9_]*|`[^`]+`)){0,2}/,\n transformer: parseTableIdentifier,\n });\n}\n","import { Formatter, type IFormatterOptions } from '@cucumber/cucumber';\n\n/**\n * Evidence formatter: schema-versioned, secret-redacted JSON summary of a\n * BDD run, shared in spirit with the live check runner's evidence output so\n * nightly runs double as audit artifacts. Wire it up in cucumber config:\n *\n * format: [['@fabricorg/databricks-bdd/evidence-formatter', 'reports/evidence.json']]\n */\nexport interface EvidenceScenario {\n name: string;\n uri: string;\n tags: string[];\n status: string;\n durationMs: number;\n error?: string;\n failures?: StepFailureEvidence[];\n}\n\nexport interface StepFailureEvidence {\n step: string;\n statementId?: string;\n sql?: string;\n output?: string;\n outputBytes?: number;\n outputTruncated?: boolean;\n}\n\nexport interface EvidenceReport {\n schemaVersion: 2;\n kind: 'databricks-bdd';\n profile: string;\n finishedAt: string;\n success: boolean;\n summary: Record<string, number>;\n scenarios: EvidenceScenario[];\n}\n\ninterface Envelope {\n attachment?: {\n body: string;\n contentEncoding: 'IDENTITY' | 'BASE64';\n mediaType: string;\n testCaseStartedId?: string;\n };\n pickle?: { id: string; name: string; uri: string; tags?: { name: string }[] };\n testCase?: { id: string; pickleId: string };\n testCaseStarted?: { id: string; testCaseId: string };\n testStepFinished?: {\n testCaseStartedId: string;\n testStepResult: {\n status: string;\n message?: string;\n duration?: { seconds: number; nanos: number };\n };\n };\n testRunFinished?: { success?: boolean; timestamp?: { seconds: number; nanos: number } };\n}\n\nexport const FAILURE_EVIDENCE_MEDIA_TYPE = 'application/vnd.fabric.databricks-bdd.failure+json';\n\nconst STATUS_RANK = ['UNKNOWN', 'PASSED', 'SKIPPED', 'PENDING', 'UNDEFINED', 'AMBIGUOUS', 'FAILED'];\n\nexport default class EvidenceFormatter extends Formatter {\n private readonly pickles = new Map<string, NonNullable<Envelope['pickle']>>();\n private readonly testCases = new Map<string, string>(); // testCaseId → pickleId\n private readonly attempts = new Map<\n string,\n {\n pickleId: string;\n status: string;\n durationMs: number;\n error?: string;\n failures: StepFailureEvidence[];\n }\n >();\n\n constructor(options: IFormatterOptions) {\n super(options);\n options.eventBroadcaster.on('envelope', (envelope: Envelope) => this.onEnvelope(envelope));\n }\n\n private onEnvelope(envelope: Envelope): void {\n if (envelope.pickle) this.pickles.set(envelope.pickle.id, envelope.pickle);\n if (envelope.testCase) this.testCases.set(envelope.testCase.id, envelope.testCase.pickleId);\n if (envelope.testCaseStarted) {\n this.attempts.set(envelope.testCaseStarted.id, {\n pickleId: this.testCases.get(envelope.testCaseStarted.testCaseId) ?? '',\n status: 'UNKNOWN',\n durationMs: 0,\n failures: [],\n });\n }\n if (envelope.attachment?.testCaseStartedId) {\n const attempt = this.attempts.get(envelope.attachment.testCaseStartedId);\n const failure = parseFailureEvidenceAttachment(envelope.attachment);\n if (attempt && failure) attempt.failures.push(failure);\n }\n if (envelope.testStepFinished) {\n const attempt = this.attempts.get(envelope.testStepFinished.testCaseStartedId);\n if (attempt) {\n const result = envelope.testStepFinished.testStepResult;\n if (STATUS_RANK.indexOf(result.status) > STATUS_RANK.indexOf(attempt.status)) {\n attempt.status = result.status;\n if (result.message) attempt.error = redactSecrets(result.message);\n }\n const d = result.duration;\n if (d) attempt.durationMs += d.seconds * 1000 + d.nanos / 1e6;\n }\n }\n if (envelope.testRunFinished) this.finish(envelope.testRunFinished);\n }\n\n private finish(finished: NonNullable<Envelope['testRunFinished']>): void {\n const scenarios: EvidenceScenario[] = [];\n const summary: Record<string, number> = {};\n for (const attempt of this.attempts.values()) {\n const pickle = this.pickles.get(attempt.pickleId);\n const status = attempt.status.toLowerCase();\n summary[status] = (summary[status] ?? 0) + 1;\n scenarios.push({\n name: pickle?.name ?? attempt.pickleId,\n uri: pickle?.uri ?? '',\n tags: (pickle?.tags ?? []).map((t) => t.name),\n status,\n durationMs: Math.round(attempt.durationMs),\n ...(attempt.error ? { error: attempt.error } : {}),\n ...(attempt.failures.length > 0 ? { failures: attempt.failures } : {}),\n });\n }\n const report: EvidenceReport = {\n schemaVersion: 2,\n kind: 'databricks-bdd',\n profile: process.env.DBX_TEST_PROFILE ?? 'local',\n finishedAt: new Date().toISOString(),\n success: finished.success ?? !scenarios.some((s) => s.status === 'failed'),\n summary,\n scenarios,\n };\n this.log(`${JSON.stringify(report, null, 2)}\\n`);\n }\n}\n\n/** Decode the structured attachment emitted by the failure hook. */\nexport function parseFailureEvidenceAttachment(\n attachment: NonNullable<Envelope['attachment']>,\n): StepFailureEvidence | null {\n if (attachment.mediaType !== FAILURE_EVIDENCE_MEDIA_TYPE) return null;\n try {\n const body =\n attachment.contentEncoding === 'BASE64'\n ? Buffer.from(attachment.body, 'base64').toString('utf8')\n : attachment.body;\n const parsed = JSON.parse(redactSecrets(body)) as Partial<StepFailureEvidence>;\n if (typeof parsed.step !== 'string') return null;\n return {\n step: parsed.step,\n ...(typeof parsed.statementId === 'string' ? { statementId: parsed.statementId } : {}),\n ...(typeof parsed.sql === 'string' ? { sql: parsed.sql } : {}),\n ...(typeof parsed.output === 'string' ? { output: parsed.output } : {}),\n ...(typeof parsed.outputBytes === 'number' ? { outputBytes: parsed.outputBytes } : {}),\n ...(typeof parsed.outputTruncated === 'boolean'\n ? { outputTruncated: parsed.outputTruncated }\n : {}),\n };\n } catch {\n return null;\n }\n}\n\nconst SECRET_ENV_RE = /(TOKEN|SECRET|PASSWORD|BEARER|KEY)/;\n\n/** Replace values of secret-looking env vars anywhere they appear in text. */\nexport function redactSecrets(\n text: string,\n env: Record<string, string | undefined> = process.env,\n): string {\n let out = text;\n for (const [name, value] of Object.entries(env)) {\n if (!value || value.length < 6) continue;\n if (!SECRET_ENV_RE.test(name)) continue;\n out = out.split(value).join('[REDACTED]');\n }\n return out;\n}\n","import type { Writable } from 'node:stream';\nimport { format } from 'node:util';\n\nexport type CapturedStream = 'stdout' | 'stderr';\n\nexport interface CapturedStepOutput {\n /** Ordered stdout/stderr output with stream labels. */\n text: string;\n /** True when output exceeded the configured byte budget. */\n truncated: boolean;\n /** Total bytes emitted before truncation. */\n totalBytes: number;\n}\n\nexport interface StepOutputCapture {\n stop(): CapturedStepOutput;\n}\n\nexport interface StepOutputCaptureOptions {\n /** Maximum UTF-8 bytes retained for one step. Defaults to 32 KiB. */\n maxBytes?: number;\n /** Forward output while capturing. Defaults to false, matching Behave capture semantics. */\n passthrough?: boolean;\n}\n\ninterface CapturedChunk {\n stream: CapturedStream;\n text: string;\n}\n\ntype Write = Writable['write'];\ntype ConsoleMethod = 'debug' | 'error' | 'info' | 'log' | 'warn';\n\nconst DEFAULT_MAX_BYTES = 32 * 1024;\n\n/**\n * Capture process stdout/stderr until stop() is called. Console output and\n * Pino's standard destination both flow through these streams. Child\n * processes that inherit the OS file descriptors directly are intentionally\n * outside this in-process capture boundary.\n */\nexport function startStepOutputCapture(options: StepOutputCaptureOptions = {}): StepOutputCapture {\n const maxBytes = Math.max(0, options.maxBytes ?? DEFAULT_MAX_BYTES);\n const stdout = process.stdout;\n const stderr = process.stderr;\n const originalStdoutWrite = stdout.write;\n const originalStderrWrite = stderr.write;\n const originalConsole = Object.fromEntries(\n (['debug', 'error', 'info', 'log', 'warn'] as const).map((method) => [method, console[method]]),\n ) as Record<ConsoleMethod, typeof console.log>;\n const chunks: CapturedChunk[] = [];\n let retainedBytes = 0;\n let totalBytes = 0;\n let stopped = false;\n\n const capture = (stream: CapturedStream, chunk: unknown): void => {\n const text = chunkToString(chunk);\n const bytes = Buffer.byteLength(text);\n totalBytes += bytes;\n const remaining = maxBytes - retainedBytes;\n if (remaining <= 0 || bytes === 0) return;\n const retained = bytes <= remaining ? text : truncateUtf8(text, remaining);\n retainedBytes += Buffer.byteLength(retained);\n if (retained) chunks.push({ stream, text: retained });\n };\n\n stdout.write = interceptedWrite(\n stdout,\n 'stdout',\n originalStdoutWrite,\n capture,\n options.passthrough,\n );\n stderr.write = interceptedWrite(\n stderr,\n 'stderr',\n originalStderrWrite,\n capture,\n options.passthrough,\n );\n if (!options.passthrough) {\n for (const method of ['debug', 'info', 'log'] as const) {\n console[method] = (...args: unknown[]) => capture('stdout', `${format(...args)}\\n`);\n }\n for (const method of ['error', 'warn'] as const) {\n console[method] = (...args: unknown[]) => capture('stderr', `${format(...args)}\\n`);\n }\n }\n\n return {\n stop(): CapturedStepOutput {\n if (!stopped) {\n stdout.write = originalStdoutWrite;\n stderr.write = originalStderrWrite;\n for (const method of Object.keys(originalConsole) as ConsoleMethod[]) {\n console[method] = originalConsole[method];\n }\n stopped = true;\n }\n return {\n text: renderChunks(chunks),\n truncated: totalBytes > retainedBytes,\n totalBytes,\n };\n },\n };\n}\n\nfunction interceptedWrite(\n destination: Writable,\n stream: CapturedStream,\n original: Write,\n capture: (stream: CapturedStream, chunk: unknown) => void,\n passthrough = false,\n): Write {\n return function write(chunk: unknown, encodingOrCallback?: unknown, callback?: unknown): boolean {\n capture(stream, chunk);\n if (passthrough) {\n return original.call(\n destination,\n chunk as never,\n encodingOrCallback as never,\n callback as never,\n );\n }\n const done = typeof encodingOrCallback === 'function' ? encodingOrCallback : callback;\n if (typeof done === 'function') queueMicrotask(() => done());\n return true;\n } as Write;\n}\n\nfunction chunkToString(chunk: unknown): string {\n if (typeof chunk === 'string') return chunk;\n if (Buffer.isBuffer(chunk)) return chunk.toString('utf8');\n if (chunk instanceof Uint8Array) return Buffer.from(chunk).toString('utf8');\n return String(chunk);\n}\n\nfunction truncateUtf8(value: string, maxBytes: number): string {\n return Buffer.from(value)\n .subarray(0, maxBytes)\n .toString('utf8')\n .replace(/\\uFFFD$/u, '');\n}\n\nfunction renderChunks(chunks: readonly CapturedChunk[]): string {\n let rendered = '';\n let previous: CapturedStream | undefined;\n for (const chunk of chunks) {\n if (chunk.stream !== previous) {\n if (rendered && !rendered.endsWith('\\n')) rendered += '\\n';\n rendered += `[${chunk.stream}]\\n`;\n previous = chunk.stream;\n }\n rendered += chunk.text;\n }\n return rendered.trimEnd();\n}\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { World, IWorldOptions } from '@cucumber/cucumber';
|
|
2
2
|
import { TestProfile, ExecutionContext, TableFixture, WorkspaceClientLike, PollOptions } from '@fabricorg/databricks-testkit';
|
|
3
3
|
export { waitForPipelineUpdate } from '@fabricorg/databricks-testkit';
|
|
4
|
+
import { FixtureSetup } from './fixtures.cjs';
|
|
5
|
+
export { FixtureCleanup, SharedFixtureRegistry, sharedFixtures } from './fixtures.cjs';
|
|
4
6
|
import { StepOutputCapture } from './output-capture.cjs';
|
|
5
7
|
export { CapturedStepOutput, StepOutputCaptureOptions, startStepOutputCapture } from './output-capture.cjs';
|
|
6
8
|
export { RUN_STATES, RunState, parseDuration, parseTableIdentifier } from './parameter-types.cjs';
|
|
@@ -35,6 +37,7 @@ declare class DatabricksWorld extends World<DatabricksWorldParameters> {
|
|
|
35
37
|
catalogOverride: string | undefined;
|
|
36
38
|
lastSql: string | undefined;
|
|
37
39
|
lastStatementId: string | undefined;
|
|
40
|
+
featureUri: string | undefined;
|
|
38
41
|
stepOutputCapture: StepOutputCapture | undefined;
|
|
39
42
|
lakebasePool: {
|
|
40
43
|
query<T extends Record<string, unknown>>(sql: string): Promise<{
|
|
@@ -50,6 +53,13 @@ declare class DatabricksWorld extends World<DatabricksWorldParameters> {
|
|
|
50
53
|
useExecutionContext(context: ExecutionContext): void;
|
|
51
54
|
/** Register scenario-scoped cleanup. Cleanups run in reverse order. */
|
|
52
55
|
addCleanup(cleanup: Cleanup): void;
|
|
56
|
+
/** Setup a resource once for this Cucumber run and clean it up in AfterAll. */
|
|
57
|
+
runFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Setup a resource once per feature file. It is isolated by feature URI and
|
|
60
|
+
* cleaned in AfterAll because cucumber-js has no reliable after-feature hook.
|
|
61
|
+
*/
|
|
62
|
+
featureFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T>;
|
|
53
63
|
/** Resolve runner userdata from worldParameters first, then DBX_TEST_USERDATA_* env. */
|
|
54
64
|
userdata(name: string): string | number | boolean | undefined;
|
|
55
65
|
scopeTo(catalog: string, schema: string): void;
|
|
@@ -119,4 +129,4 @@ interface RunFeaturesResult {
|
|
|
119
129
|
*/
|
|
120
130
|
declare function runFeatures(options: RunFeaturesOptions): Promise<RunFeaturesResult>;
|
|
121
131
|
|
|
122
|
-
export { DatabricksWorld, type DatabricksWorldParameters, type JobRunResult, LIVE_ONLY_TAGS, type PipelineWaitOptions, type RunFeaturesOptions, type RunFeaturesResult, type RunJobOptions, StepOutputCapture, coerceMatchRows, inferFixture, liveOnlyReason, resolveJobId, resolvePipelineId, runFeatures, runJobToTerminal, startPipelineUpdate };
|
|
132
|
+
export { DatabricksWorld, type DatabricksWorldParameters, FixtureSetup, type JobRunResult, LIVE_ONLY_TAGS, type PipelineWaitOptions, type RunFeaturesOptions, type RunFeaturesResult, type RunJobOptions, StepOutputCapture, coerceMatchRows, inferFixture, liveOnlyReason, resolveJobId, resolvePipelineId, runFeatures, runJobToTerminal, startPipelineUpdate };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { World, IWorldOptions } from '@cucumber/cucumber';
|
|
2
2
|
import { TestProfile, ExecutionContext, TableFixture, WorkspaceClientLike, PollOptions } from '@fabricorg/databricks-testkit';
|
|
3
3
|
export { waitForPipelineUpdate } from '@fabricorg/databricks-testkit';
|
|
4
|
+
import { FixtureSetup } from './fixtures.js';
|
|
5
|
+
export { FixtureCleanup, SharedFixtureRegistry, sharedFixtures } from './fixtures.js';
|
|
4
6
|
import { StepOutputCapture } from './output-capture.js';
|
|
5
7
|
export { CapturedStepOutput, StepOutputCaptureOptions, startStepOutputCapture } from './output-capture.js';
|
|
6
8
|
export { RUN_STATES, RunState, parseDuration, parseTableIdentifier } from './parameter-types.js';
|
|
@@ -35,6 +37,7 @@ declare class DatabricksWorld extends World<DatabricksWorldParameters> {
|
|
|
35
37
|
catalogOverride: string | undefined;
|
|
36
38
|
lastSql: string | undefined;
|
|
37
39
|
lastStatementId: string | undefined;
|
|
40
|
+
featureUri: string | undefined;
|
|
38
41
|
stepOutputCapture: StepOutputCapture | undefined;
|
|
39
42
|
lakebasePool: {
|
|
40
43
|
query<T extends Record<string, unknown>>(sql: string): Promise<{
|
|
@@ -50,6 +53,13 @@ declare class DatabricksWorld extends World<DatabricksWorldParameters> {
|
|
|
50
53
|
useExecutionContext(context: ExecutionContext): void;
|
|
51
54
|
/** Register scenario-scoped cleanup. Cleanups run in reverse order. */
|
|
52
55
|
addCleanup(cleanup: Cleanup): void;
|
|
56
|
+
/** Setup a resource once for this Cucumber run and clean it up in AfterAll. */
|
|
57
|
+
runFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T>;
|
|
58
|
+
/**
|
|
59
|
+
* Setup a resource once per feature file. It is isolated by feature URI and
|
|
60
|
+
* cleaned in AfterAll because cucumber-js has no reliable after-feature hook.
|
|
61
|
+
*/
|
|
62
|
+
featureFixture<T>(key: string, setup: FixtureSetup<T>): Promise<T>;
|
|
53
63
|
/** Resolve runner userdata from worldParameters first, then DBX_TEST_USERDATA_* env. */
|
|
54
64
|
userdata(name: string): string | number | boolean | undefined;
|
|
55
65
|
scopeTo(catalog: string, schema: string): void;
|
|
@@ -119,4 +129,4 @@ interface RunFeaturesResult {
|
|
|
119
129
|
*/
|
|
120
130
|
declare function runFeatures(options: RunFeaturesOptions): Promise<RunFeaturesResult>;
|
|
121
131
|
|
|
122
|
-
export { DatabricksWorld, type DatabricksWorldParameters, type JobRunResult, LIVE_ONLY_TAGS, type PipelineWaitOptions, type RunFeaturesOptions, type RunFeaturesResult, type RunJobOptions, StepOutputCapture, coerceMatchRows, inferFixture, liveOnlyReason, resolveJobId, resolvePipelineId, runFeatures, runJobToTerminal, startPipelineUpdate };
|
|
132
|
+
export { DatabricksWorld, type DatabricksWorldParameters, FixtureSetup, type JobRunResult, LIVE_ONLY_TAGS, type PipelineWaitOptions, type RunFeaturesOptions, type RunFeaturesResult, type RunJobOptions, StepOutputCapture, coerceMatchRows, inferFixture, liveOnlyReason, resolveJobId, resolvePipelineId, runFeatures, runJobToTerminal, startPipelineUpdate };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { DatabricksWorld, LIVE_ONLY_TAGS, coerceMatchRows, inferFixture, liveOnlyReason, resolveJobId, resolvePipelineId, runJobToTerminal, startPipelineUpdate, waitForPipelineUpdate } from './chunk-
|
|
1
|
+
export { DatabricksWorld, LIVE_ONLY_TAGS, coerceMatchRows, inferFixture, liveOnlyReason, resolveJobId, resolvePipelineId, runJobToTerminal, startPipelineUpdate, waitForPipelineUpdate } from './chunk-355WDWP3.js';
|
|
2
2
|
export { FAILURE_EVIDENCE_MEDIA_TYPE, parseFailureEvidenceAttachment, redactSecrets } from './chunk-UQAKGVJS.js';
|
|
3
|
+
export { SharedFixtureRegistry, sharedFixtures } from './chunk-SZL3KWW7.js';
|
|
3
4
|
export { startStepOutputCapture } from './chunk-THB7O2G6.js';
|
|
4
5
|
export { RUN_STATES, parseDuration, parseTableIdentifier } from './chunk-YNOLRERF.js';
|
|
5
6
|
import { execFile } from 'child_process';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/run-features.ts"],"names":["require"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/run-features.ts"],"names":["require"],"mappings":";;;;;;;;;AA2BA,eAAsB,YAAY,OAAA,EAAyD;AACzF,EAAA,MAAMA,QAAAA,GAAU,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAG7C,EAAA,MAAM,OAAA,GAAUA,QAAAA,CAAQ,OAAA,CAAQ,iCAAiC,CAAA;AACjE,EAAA,MAAM,GAAA,GAAMA,SAAQ,OAAO,CAAA;AAC3B,EAAA,MAAM,GAAA,GAAM,KAAK,OAAA,CAAQ,OAAO,GAAG,GAAA,CAAI,GAAA,CAAI,aAAa,CAAA,IAAK,iBAAiB,CAAA;AAC9E,EAAA,MAAM,MAAyB,EAAE,GAAG,QAAQ,GAAA,EAAK,GAAG,QAAQ,GAAA,EAAI;AAChE,EAAA,IAAI,OAAA,CAAQ,OAAO,IAAA,EAAM;AACvB,IAAA,MAAM,SAAA,GAAY,cAAA;AAClB,IAAA,GAAA,CAAI,YAAA,GAAe,IAAI,YAAA,GAAe,CAAA,EAAG,IAAI,YAAY,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,GAAK,SAAA;AAAA,EAC7E;AACA,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,KAAY;AAC9B,IAAA,QAAA;AAAA,MACE,OAAA,CAAQ,QAAA;AAAA,MACR,CAAC,GAAA,EAAK,GAAI,OAAA,CAAQ,IAAA,IAAQ,EAAG,CAAA;AAAA,MAC7B,EAAE,GAAA,EAAK,OAAA,CAAQ,GAAA,EAAK,GAAA,EAAK,OAAA,EAAS,OAAA,CAAQ,SAAA,IAAa,IAAA,EAAS,SAAA,EAAW,EAAA,GAAK,IAAA,GAAO,IAAA,EAAK;AAAA,MAC5F,CAAC,KAAA,EAAO,MAAA,EAAQ,MAAA,KAAW;AACzB,QAAA,MAAM,QAAA,GACJ,KAAA,IAAS,OAAQ,KAAA,CAA6B,IAAA,KAAS,WACjD,KAAA,CAA4B,IAAA,IAAQ,CAAA,GACtC,KAAA,GACE,CAAA,GACA,CAAA;AACR,QAAA,OAAA,CAAQ,EAAE,OAAA,EAAS,QAAA,KAAa,GAAG,QAAA,EAAU,MAAA,EAAQ,GAAG,MAAM;AAAA,EAAK,MAAM,IAAI,CAAA;AAAA,MAC/E;AAAA,KACF;AAAA,EACF,CAAC,CAAA;AACH","file":"index.js","sourcesContent":["import { execFile } from 'node:child_process';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\n\nexport interface RunFeaturesOptions {\n /** Directory containing the cucumber config / features. */\n cwd: string;\n /** Extra CLI args, e.g. ['--tags', 'not @slow'] or ['features/foo.feature']. */\n args?: string[];\n /** Extra environment (merged over process.env). */\n env?: Record<string, string>;\n /** Load TypeScript support code via tsx (default true). */\n tsx?: boolean;\n timeoutMs?: number;\n}\n\nexport interface RunFeaturesResult {\n success: boolean;\n exitCode: number;\n output: string;\n}\n\n/**\n * Vitest bridge: run cucumber-js as a subprocess so feature suites can be\n * embedded in an existing vitest run (one CI entry point) without fighting\n * over cucumber's global step registry or vitest's module transforms.\n */\nexport async function runFeatures(options: RunFeaturesOptions): Promise<RunFeaturesResult> {\n const require = createRequire(import.meta.url);\n // The bin path is not in the package's exports map — resolve it relative\n // to package.json (which is exported).\n const pkgPath = require.resolve('@cucumber/cucumber/package.json');\n const pkg = require(pkgPath) as { bin: Record<string, string> };\n const bin = join(dirname(pkgPath), pkg.bin['cucumber-js'] ?? 'bin/cucumber.js');\n const env: NodeJS.ProcessEnv = { ...process.env, ...options.env };\n if (options.tsx ?? true) {\n const tsxImport = '--import tsx';\n env.NODE_OPTIONS = env.NODE_OPTIONS ? `${env.NODE_OPTIONS} ${tsxImport}` : tsxImport;\n }\n return new Promise((resolve) => {\n execFile(\n process.execPath,\n [bin, ...(options.args ?? [])],\n { cwd: options.cwd, env, timeout: options.timeoutMs ?? 120_000, maxBuffer: 16 * 1024 * 1024 },\n (error, stdout, stderr) => {\n const exitCode =\n error && typeof (error as { code?: unknown }).code === 'number'\n ? ((error as { code?: number }).code ?? 1)\n : error\n ? 1\n : 0;\n resolve({ success: exitCode === 0, exitCode, output: `${stdout}\\n${stderr}` });\n },\n );\n });\n}\n"]}
|
package/dist/steps.cjs
CHANGED
|
@@ -21,6 +21,65 @@ function redactSecrets(text, env = process.env) {
|
|
|
21
21
|
return out;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// src/fixtures.ts
|
|
25
|
+
function isFixtureResult(value) {
|
|
26
|
+
return typeof value === "object" && value !== null && Object.prototype.hasOwnProperty.call(value, "value") && typeof value.cleanup === "function";
|
|
27
|
+
}
|
|
28
|
+
var SharedFixtureRegistry = class {
|
|
29
|
+
runEntries = /* @__PURE__ */ new Map();
|
|
30
|
+
featureEntries = /* @__PURE__ */ new Map();
|
|
31
|
+
cleanupOrder = [];
|
|
32
|
+
runFixture(key, setup) {
|
|
33
|
+
return this.resolve(this.runEntries, key, setup);
|
|
34
|
+
}
|
|
35
|
+
featureFixture(featureUri, key, setup) {
|
|
36
|
+
if (!featureUri) throw new Error("featureFixture requires a feature URI");
|
|
37
|
+
let feature = this.featureEntries.get(featureUri);
|
|
38
|
+
if (!feature) {
|
|
39
|
+
feature = /* @__PURE__ */ new Map();
|
|
40
|
+
this.featureEntries.set(featureUri, feature);
|
|
41
|
+
}
|
|
42
|
+
return this.resolve(feature, key, setup);
|
|
43
|
+
}
|
|
44
|
+
resolve(entries, key, setup) {
|
|
45
|
+
if (!key.trim()) throw new Error("Fixture key must not be empty");
|
|
46
|
+
const existing = entries.get(key);
|
|
47
|
+
if (existing) return existing.value;
|
|
48
|
+
const entry = {
|
|
49
|
+
value: Promise.resolve().then(setup).then((result) => {
|
|
50
|
+
if (isFixtureResult(result)) {
|
|
51
|
+
entry.cleanup = result.cleanup;
|
|
52
|
+
return result.value;
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}).catch((error) => {
|
|
56
|
+
entries.delete(key);
|
|
57
|
+
const index = this.cleanupOrder.indexOf(entry);
|
|
58
|
+
if (index >= 0) this.cleanupOrder.splice(index, 1);
|
|
59
|
+
throw error;
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
entries.set(key, entry);
|
|
63
|
+
this.cleanupOrder.push(entry);
|
|
64
|
+
return entry.value;
|
|
65
|
+
}
|
|
66
|
+
async dispose() {
|
|
67
|
+
const errors = [];
|
|
68
|
+
for (const entry of this.cleanupOrder.splice(0).reverse()) {
|
|
69
|
+
try {
|
|
70
|
+
await entry.value.catch(() => void 0);
|
|
71
|
+
await entry.cleanup?.();
|
|
72
|
+
} catch (error) {
|
|
73
|
+
errors.push(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.runEntries.clear();
|
|
77
|
+
this.featureEntries.clear();
|
|
78
|
+
if (errors.length > 0) throw new AggregateError(errors, "Shared fixture cleanup failed");
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var sharedFixtures = new SharedFixtureRegistry();
|
|
82
|
+
|
|
24
83
|
// src/infer.ts
|
|
25
84
|
var INT_RE = /^-?\d+$/;
|
|
26
85
|
var FLOAT_RE = /^-?\d+\.\d+$/;
|
|
@@ -278,6 +337,7 @@ var DatabricksWorld = class extends cucumber.World {
|
|
|
278
337
|
catalogOverride;
|
|
279
338
|
lastSql;
|
|
280
339
|
lastStatementId;
|
|
340
|
+
featureUri;
|
|
281
341
|
stepOutputCapture;
|
|
282
342
|
lakebasePool;
|
|
283
343
|
ctx;
|
|
@@ -316,6 +376,20 @@ var DatabricksWorld = class extends cucumber.World {
|
|
|
316
376
|
addCleanup(cleanup) {
|
|
317
377
|
this.cleanups.push(cleanup);
|
|
318
378
|
}
|
|
379
|
+
/** Setup a resource once for this Cucumber run and clean it up in AfterAll. */
|
|
380
|
+
runFixture(key, setup) {
|
|
381
|
+
return sharedFixtures.runFixture(key, setup);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Setup a resource once per feature file. It is isolated by feature URI and
|
|
385
|
+
* cleaned in AfterAll because cucumber-js has no reliable after-feature hook.
|
|
386
|
+
*/
|
|
387
|
+
featureFixture(key, setup) {
|
|
388
|
+
if (!this.featureUri) {
|
|
389
|
+
throw new Error("featureFixture is only available after the scenario Before hook");
|
|
390
|
+
}
|
|
391
|
+
return sharedFixtures.featureFixture(this.featureUri, key, setup);
|
|
392
|
+
}
|
|
319
393
|
/** Resolve runner userdata from worldParameters first, then DBX_TEST_USERDATA_* env. */
|
|
320
394
|
userdata(name) {
|
|
321
395
|
const configured = this.parameters.userdata?.[name];
|
|
@@ -354,7 +428,7 @@ var DatabricksWorld = class extends cucumber.World {
|
|
|
354
428
|
|
|
355
429
|
// src/steps.ts
|
|
356
430
|
cucumber.setWorldConstructor(DatabricksWorld);
|
|
357
|
-
cucumber.setDefaultTimeout(6e4);
|
|
431
|
+
cucumber.setDefaultTimeout(databricksTestkit.resolveProfile() === "live" ? 20 * 6e4 : 6e4);
|
|
358
432
|
registerParameterTypes();
|
|
359
433
|
cucumber.BeforeAll(async () => {
|
|
360
434
|
if (databricksTestkit.resolveProfile() !== "live") return;
|
|
@@ -369,11 +443,15 @@ cucumber.BeforeAll(async () => {
|
|
|
369
443
|
}
|
|
370
444
|
});
|
|
371
445
|
cucumber.Before(function({ pickle }) {
|
|
446
|
+
this.featureUri = pickle.uri;
|
|
372
447
|
const tags = pickle.tags.map((t) => t.name);
|
|
373
448
|
const reason = liveOnlyReason(tags, this.profile);
|
|
374
449
|
if (reason) return "skipped";
|
|
375
450
|
return void 0;
|
|
376
451
|
});
|
|
452
|
+
cucumber.AfterAll(async () => {
|
|
453
|
+
await sharedFixtures.dispose();
|
|
454
|
+
});
|
|
377
455
|
cucumber.BeforeStep(function() {
|
|
378
456
|
const captureMode = process.env.DBX_TEST_CAPTURE_OUTPUT?.toLowerCase();
|
|
379
457
|
if (captureMode === "off") return;
|