@gfdelarue/testkit 0.3.2 → 0.3.3
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/bin/testkit-windows-owner-arm64.exe +0 -0
- package/bin/testkit-windows-owner-x64.exe +0 -0
- package/dist/app/cloud/control.js +2 -2
- package/dist/app/cloud/login.d.ts +4 -4
- package/dist/app/inspect/artifacts.d.ts +4 -4
- package/dist/app/run/engine-failure-stack.d.ts +1 -0
- package/dist/app/run/engine-failure-stack.js +2 -0
- package/dist/app/run/worker-loop.js +1 -1
- package/dist/app/setup/playwright.js +1 -1
- package/dist/app/typecheck/index.js +4 -4
- package/dist/cli/command-catalog.d.ts +24 -24
- package/dist/cli/command-flags.d.ts +3 -3
- package/dist/cli/commands/artifacts.d.ts +16 -16
- package/dist/cli/commands/cleanup.d.ts +1 -1
- package/dist/cli/commands/cloud/login.d.ts +1 -1
- package/dist/cli/commands/cloud/status.d.ts +3 -3
- package/dist/config/loader/discover-tests.d.ts +5 -0
- package/dist/config/loader/discover-tests.js +1 -1
- package/dist/config/loader/file-metadata.d.ts +1 -1
- package/dist/config/loader/file-metadata.js +1 -1
- package/dist/config/loader/index.d.ts +1 -1
- package/dist/config/loader/index.js +1 -1
- package/dist/database/docker-metadata.d.ts +3 -0
- package/dist/database/docker-metadata.js +3 -0
- package/dist/database/docker.js +5 -5
- package/dist/database/index.js +1 -1
- package/dist/database/local-postgres.js +1 -1
- package/dist/database/postgres/index.js +2 -2
- package/dist/database/runtime-config.d.ts +5 -5
- package/dist/database/schema-source.d.ts +4 -1
- package/dist/database/schema-source.js +3 -3
- package/dist/database/template-steps.d.ts +4 -0
- package/dist/database/template-steps.js +4 -4
- package/dist/engines/managed-module-resolution.js +5 -3
- package/dist/engines/node-vitest/adapter/consumer-typescript-paths.js +2 -2
- package/dist/engines/node-vitest/runtime/runtime-input.js +1 -1
- package/dist/engines/playwright/runtime/runtime-input.js +1 -1
- package/dist/environment/template.d.ts +20 -20
- package/dist/process/execa-bundle-licenses.txt +411 -0
- package/dist/process/execa-bundle.json +874 -0
- package/dist/process/files/json-file.js +1 -1
- package/dist/process/host-process.d.ts +6 -1
- package/dist/process/host-process.js +1 -1
- package/dist/process/index.d.ts +2 -2
- package/dist/process/locks.js +3 -3
- package/dist/process/process-contracts.d.ts +10 -2
- package/dist/process/process-identity.js +1 -1
- package/dist/process/process.d.ts +3 -2
- package/dist/process/process.js +46 -1
- package/dist/repo/metadata.js +1 -1
- package/dist/repo/state.d.ts +1 -0
- package/dist/repo/state.js +4 -4
- package/dist/steps/configured-step-testkit-modules.d.ts +1 -1
- package/dist/steps/run.js +2 -2
- package/dist/toolchains/archive.js +1 -1
- package/dist/toolchains/node-integrity.d.ts +2 -0
- package/dist/toolchains/node-integrity.js +1 -1
- package/dist/toolchains/node-provisioning.js +2 -2
- package/package.json +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
`)}})],
|
|
3
|
-
`)).filter(
|
|
4
|
-
`)}function
|
|
1
|
+
import c from"fs";import{buildTemplateExecutionEnv as m,collectConfiguredInputs as h}from"../steps/index.js";import{runConfiguredSteps as A}from"./configured-steps.js";import"../evidence/setup-progress.js";import{captureOutput as E}from"../process/index.js";import{assertPgDumpArgsAreSourceSafe as T}from"./source-url.js";import{runDockerPsql as v,startDockerPgDump as D}from"./postgres/index.js";const p=String,x=["migrate","seed","verify"];export function runTemplateStage(e,n,t,r={}){const o=e.testkit.database?.template?.[n]||[];return l(e,n,o,0,t,r)}export function runTemplateStep(e,n,t,r,o,i={}){return l(e,n,[t],r,o,i)}async function l(e,n,t,r,o,i){await A({...i,config:e,steps:t,env:{...m(e,{},process.env),DATABASE_URL:o},labelPrefix:`template:${n}`,startIndex:r})}export function collectTemplateInputs(e,n={}){const t=x.flatMap(r=>n[r]||[]);return h(e,{inputs:n.inputs||[],steps:t})}export async function captureTemplateSnapshotText(e,n,t={}){const r=t.image||await resolvePgDumpClientImage(e,n,t);return sanitizeSnapshotText(await d(e,n,{...t,image:r}))}export async function dumpPostgresSchemaToFile(e,n,t,r={}){const o=await d(e,t,r);c.writeFileSync(n,o),sanitizeSnapshotFile(n)}async function d(e,n,t){const r={...m(e,{},t.env||process.env),...S(n,{applicationName:t.pgApplicationName})},o=pgDumpArgs();T(o);const i=await C(e,o,r,t);if(i.exitCode!==0)throw new Error(i.shortMessage||i.stderr||i.stdout||"pg_dump failed");return i.stdout}export function pgDumpArgs(){return["--schema-only","--no-owner","--no-privileges"]}function f(e){return{host:e.PGHOST,port:e.PGPORT||5432,database:e.PGDATABASE,user:e.PGUSER,password:e.PGPASSWORD,sslMode:e.PGSSLMODE}}async function C(e,n,t,r={}){const o=D({args:n,cwd:e.productDir,env:t,image:r.image||null,ownedContainer:r.ownedContainer||null,signal:r.signal,connection:f(t)}),i=r.reporter,s=i?.outputMode==="debug"?a=>i.writeDebugLine?.(a):null,u=r.logRecord||null,w=[E(o.stderr,{livePrefix:`[${e.runtimeLabel||e.name}:${e.name}]`,liveWriter:s,onLine(a){u&&u.write(`${new Date().toISOString()} [stderr] ${a}
|
|
2
|
+
`)}})],P=await o;return await Promise.all(w),P}export async function resolvePgDumpClientImage(e,n,t={}){const r=t.env||process.env,o=g(r);if(o)return o;const i={...r,...S(n,{applicationName:t.pgApplicationName})},s=await v({args:["-tAc","SHOW server_version_num"],cwd:e.productDir,env:i,ownedContainer:t.ownedContainer||null,signal:t.signal,connection:f(i)});if(s.exitCode!==0)throw new Error(s.shortMessage||s.stderr||s.stdout||"Failed to detect source Postgres version");return postgresClientImageForServerVersion(s.stdout)}export function createOwnedPgDumpClientImageResolver(e,n,t){const r={...t,ownedContainer:{...t.ownedContainer}};let o;return async()=>{const i=g(r.env||process.env);return i||(o??=await resolvePgDumpClientImage(e,n,r),o)}}export function postgresClientImageForServerVersion(e){const n=Number(p(O(e,"")).trim());if(!Number.isFinite(n)||n<1e5)throw new Error(`Unable to determine Postgres major version from server_version_num: ${JSON.stringify(e)}`);return`postgres:${String(Math.floor(n/1e4))}`}function g(e){return e.TESTKIT_POSTGRES_CLIENT_IMAGE||null}function S(e,n={}){const t=new URL(e);return y({PGHOST:t.hostname,PGPORT:t.port||"5432",PGDATABASE:decodeURIComponent(t.pathname.replace(/^\//,"")),PGUSER:decodeURIComponent(t.username||""),PGPASSWORD:decodeURIComponent(t.password||""),PGSSLMODE:t.searchParams.get("sslmode")||void 0,PGAPPNAME:n.applicationName||void 0})}function y(e){const n={};for(const[t,r]of Object.entries(e))r!=null&&r!==""&&(n[t]=r);return n}export function sanitizeSnapshotFile(e){const n=c.readFileSync(e,"utf8"),t=sanitizeSnapshotText(n);t!==n&&c.writeFileSync(e,t)}export function sanitizeSnapshotText(e){return b(p(e).split(`
|
|
3
|
+
`)).filter(n=>{const t=n.trim();return!t.startsWith("-- Dumped from database version ")&&!t.startsWith("-- Dumped by pg_dump version ")&&t!=="SET transaction_timeout = 0;"&&!t.startsWith("\\restrict ")&&!t.startsWith("\\unrestrict ")}).join(`
|
|
4
|
+
`)}function b(e){const n=[];for(let t=0;t<e.length;t+=1){if(e[t]?.trim()==="--"&&e[t+1]?.startsWith("-- Name: public; Type: SCHEMA;")){let r=t+1;for(;r<e.length&&!e[r]?.includes("*not* creating schema");)r+=1;if(r<e.length){for(;r+1<e.length&&e[r+1]?.trim()==="";)r+=1;t=r;continue}}n.push(e[t])}return n}function O(e,n){return!!e?e:n}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{inspectManagedNodeModuleResolutionPolicy as o}from"./managed-module-resolution-policy.js";export function createManagedNodeModuleResolution(e){const t=o(e),
|
|
1
|
+
import{inspectManagedNodeModuleResolutionPolicy as o}from"./managed-module-resolution-policy.js";export function createManagedNodeModuleResolution(e){const t=o(e),n={...t.direct};for(const[a,i]of Object.entries(t.packageExports)){const r=i.import??i.default??i.require;r!==null&&(n[a]=r)}return Object.freeze({aliases:Object.freeze(n),bootstrapSource:s(t),dependencyRoots:t.managedImporterRoots})}export function managedNodeModuleResolutionBootstrapSource(e){return createManagedNodeModuleResolution(e).bootstrapSource}function s(e){return`
|
|
2
2
|
const fs = require("node:fs");
|
|
3
3
|
const path = require("node:path");
|
|
4
4
|
const { registerHooks } = require("node:module");
|
|
@@ -316,8 +316,9 @@ function classifyResolvedSpecifier(specifier, parentURL) {
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
function exactDirectSpecifier(file) {
|
|
319
|
+
const canonicalFile = canonicalPath(file);
|
|
319
320
|
for (const [specifier, target] of DIRECT) {
|
|
320
|
-
if (
|
|
321
|
+
if (canonicalFile === canonicalPath(target)) return specifier;
|
|
321
322
|
}
|
|
322
323
|
return null;
|
|
323
324
|
}
|
|
@@ -579,6 +580,7 @@ function isManagedDependencyFile(file) {
|
|
|
579
580
|
function exactExportedSubpathForFile(exportsDeclaration, packageRoot, file) {
|
|
580
581
|
if (exportsDeclaration === null || typeof exportsDeclaration !== "object")
|
|
581
582
|
return null;
|
|
583
|
+
const canonicalFile = canonicalPath(file);
|
|
582
584
|
for (const [subpath, declaration] of Object.entries(exportsDeclaration)) {
|
|
583
585
|
if (
|
|
584
586
|
(subpath !== "." && !subpath.startsWith("./")) ||
|
|
@@ -590,7 +592,7 @@ function exactExportedSubpathForFile(exportsDeclaration, packageRoot, file) {
|
|
|
590
592
|
if (
|
|
591
593
|
target.startsWith("./") &&
|
|
592
594
|
!target.includes("*") &&
|
|
593
|
-
|
|
595
|
+
canonicalPath(path.resolve(packageRoot, target)) === canonicalFile
|
|
594
596
|
) {
|
|
595
597
|
return subpath;
|
|
596
598
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{isPathWithin as y}from"../../../process/files/paths.js";import u from"node:fs";import i from"node:path";import{fileURLToPath as
|
|
1
|
+
import{isPathWithin as y}from"../../../process/files/paths.js";import u from"node:fs";import{createRequire as h}from"node:module";import i from"node:path";import{fileURLToPath as l}from"node:url";import{NODE_VITEST_PACKAGE_REQUIREMENTS as N}from"../../installations/node-vitest.js";export const managedTypeScriptFile=l(import.meta.resolve("typescript"));const k=/^@gfdelarue\/testkit(?:\/|$)/u;export function createConsumerTypeScriptPathsPlugin(t,e){const r=h(import.meta.url)(managedTypeScriptFile),n=S(t,r),o=Object.keys(n.paths??{});return o.length===0?null:{enforce:"pre",name:"testkit-node-vitest-consumer-typescript-paths",resolveId(a,s){if(s===void 0||isNodeVitestManagedDependencyImporter(s,e.dependencyRoots)||k.test(a)||!o.some(g=>w(a,g)))return null;const c=x(s);if(c===null)return null;const f=r.resolveModuleName(a,c,n,r.sys).resolvedModule?.resolvedFileName;return f===void 0?null:assertNodeVitestConsumerResolution(a,f,s,e)}}}export function assertNodeVitestConsumerResolution(t,e,r,n){if(isNodeVitestManagedDependencyImporter(r,n.dependencyRoots))return e;const o=d(e);if(o===null)return e;const a=v(o);if(a===null)return e;if(a.privatePackage)throw new Error(`Node/Vitest consumers may not resolve ${JSON.stringify(t)} into private Vitest package ${a.packageName}`);const s=n.aliases[t];if(Object.hasOwn(n.aliases,t)&&m(o,s)||Object.values(n.aliases).some(c=>m(o,c)))return e;throw new Error(`Node/Vitest consumers may not resolve ${JSON.stringify(t)} into managed direct package ${a.packageName}; import an exact public ${JSON.stringify(a.packageName)} export instead`)}function v(t){const e=[t];try{const r=u.realpathSync(t);r!==t&&e.push(r)}catch{}for(const r of e){let n=i.dirname(r);for(;;){const o=i.join(n,"package.json");if(u.existsSync(o)){const s=E(o);if(s!==null){if(s.startsWith("@vitest/"))return{packageName:s,privatePackage:!0};if(N.some(({packageName:c})=>c===s))return{packageName:s,privatePackage:!1}}}const a=i.dirname(n);if(a===n)break;n=a}}return null}function E(t){let e;try{e=JSON.parse(u.readFileSync(t,"utf8"))}catch(n){throw new Error(`Cannot inspect package boundary at ${t}`,{cause:n})}if(typeof e!="object"||e===null||Array.isArray(e))return null;const r=Reflect.get(e,"name");return typeof r=="string"?r:null}export function isNodeVitestManagedDependencyImporter(t,e){if(t===void 0)return!1;const r=d(t);return r===null?!1:e.some(n=>y(n,r))}function d(t){const e=t.split(/[?#]/u,1)[0];if(e.startsWith("\0"))return null;if(e.startsWith("file:"))return l(e);const r=e.startsWith("/@fs/")?e.slice(4):e;return i.isAbsolute(r)?i.resolve(r):null}function m(t,e){try{return u.realpathSync(t)===u.realpathSync(e)}catch{return i.resolve(t)===i.resolve(e)}}function S(t,e){const r=i.resolve(t).replaceAll(i.sep,"/"),n=i.posix.dirname(r),o=e.readConfigFile(r,c=>e.sys.readFile(c));if(o.error!==void 0)throw new Error(p(r,[o.error],e));const a=e.parseJsonConfigFileContent(o.config,e.sys,n,{},r),s=a.errors.filter(c=>c.category===e.DiagnosticCategory.Error&&c.code!==18003);if(s.length>0)throw new Error(p(r,s,e));return a.options}function p(t,e,r){const n=r.formatDiagnostics(e,{getCanonicalFileName:o=>o,getCurrentDirectory:()=>i.posix.dirname(t),getNewLine:()=>`
|
|
2
2
|
`});return`Cannot load explicit consumer TypeScript paths from ${t}:
|
|
3
|
-
${
|
|
3
|
+
${n}`.trim()}function w(t,e){const r=e.indexOf("*");if(r===-1)return t===e;const n=e.slice(0,r),o=e.slice(r+1);return t.startsWith(n)&&t.endsWith(o)}function x(t){const e=t.split(/[?#]/u,1)[0];return e.startsWith("file:")?l(e):i.isAbsolute(e)?e:null}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import m from"node:fs/promises";import w from"node:path";import{readVerifiedOwnedFile as f,writeOwnedRuntimeInput as S,RUNTIME_INPUT_BYTE_MEASURE as O}from"../../runtime-input-file.js";import{requireBoundedJsonValue as h,RUNTIME_INPUT_JSON_BOUNDS as V}from"../../contracts/json-bounds.js";import{ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS as l
|
|
1
|
+
import m from"node:fs/promises";import w from"node:path";import{readVerifiedOwnedFile as f,writeOwnedRuntimeInput as S,RUNTIME_INPUT_BYTE_MEASURE as O}from"../../runtime-input-file.js";import{requireBoundedJsonValue as h,RUNTIME_INPUT_JSON_BOUNDS as V}from"../../contracts/json-bounds.js";import{ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS as l}from"../../../process/environment.js";import{installManagedProcessEnvironmentOverlay as R}from"../../../process/environment-overlay.js";export const NODE_VITEST_RUNTIME_INPUT_VERSION=1,NODE_VITEST_RUNTIME_INPUT_FILENAME="runtime-input.json",NODE_VITEST_RUNTIME_INPUT_FILE_ENV="TESTKIT_NODE_VITEST_INPUT_FILE",NODE_VITEST_RUNTIME_INPUT_SHA256_ENV="TESTKIT_NODE_VITEST_INPUT_SHA256",NODE_VITEST_RUNTIME_INPUT_SYMBOL="elench.testkit.node-vitest.runtime-input.v1",NODE_VITEST_DATA_BUDGET_FAILURE_DETAIL_KIND="data-flow-budget",NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_KIND="testkit.failure-details",NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_NAME="data-flow-failure-details";const E={filename:NODE_VITEST_RUNTIME_INPUT_FILENAME,label:"Node/Vitest runtime input",maxSizeBytes:8*1024*1024},N=512,p=4*1024*1024,x=new Set(["BASE_URL","FORCE_COLOR","NODE_OPTIONS","NO_COLOR","UPDATE_SNAPSHOT",...l].map(t=>t.toUpperCase()));export const MAX_NODE_VITEST_SPAWN_ENVIRONMENT_UNITS=24*1024;export async function writeOwnedNodeVitestRuntimeInput(t,e){return S(t,e,E)}export async function verifyOwnedNodeVitestRuntimeInput(t){await f(t,E)}export function selectNodeVitestForwardedEnvironment(t){const e={...t};return _(e),e}export function assertNodeVitestSpawnEnvironmentBudget(t){if(Object.entries(t).reduce((n,[o,r])=>n+o.length+r.length+2,1)>MAX_NODE_VITEST_SPAWN_ENVIRONMENT_UNITS)throw new Error(`Node/Vitest process environment exceeds the ${MAX_NODE_VITEST_SPAWN_ENVIRONMENT_UNITS.toString()} character environment-block budget`)}export async function installNodeVitestRuntimeInput(t){const e=process.env[NODE_VITEST_RUNTIME_INPUT_FILE_ENV],n=process.env[NODE_VITEST_RUNTIME_INPUT_SHA256_ENV];if(e!==t.expectedFile)throw new Error("Node/Vitest runtime input pointer does not match its engine-owned path");if(n!==t.expectedSha256)throw new Error("Node/Vitest runtime input digest does not match its prepared value");const o=await m.lstat(t.expectedFile),r={directory:w.dirname(t.expectedFile),file:t.expectedFile,sha256:t.expectedSha256,sizeBytes:o.size},c=await f(r,E);let i;try{i=JSON.parse(c)}catch(u){throw new Error("Node/Vitest runtime input contains invalid JSON",{cause:u})}const s=a(I(i));if(s.invocationId!==t.expectedInvocationId||s.profileId!==t.expectedProfileId||s.taskId!==t.expectedTaskId)throw new Error("Node/Vitest runtime input identity does not match its task");R({environment:s.environment,label:"Node/Vitest"}),Object.defineProperty(globalThis,Symbol.for(NODE_VITEST_RUNTIME_INPUT_SYMBOL),{configurable:!0,enumerable:!1,value:s,writable:!1}),applyNodeVitestEngineEnvironment()}export function applyNodeVitestEngineEnvironment(){const t=readNodeVitestRuntimeInput();if(t===null)throw new Error("Node/Vitest runtime input is not installed");const e=t.context.baseUrl;typeof e=="string"?process.env.BASE_URL=e:Reflect.deleteProperty(process.env,"BASE_URL")}export function readNodeVitestRuntimeInput(){const t=Reflect.get(globalThis,Symbol.for(NODE_VITEST_RUNTIME_INPUT_SYMBOL));return t===void 0?null:a(I(t,"Installed Node/Vitest runtime input"))}function I(t,e="Node/Vitest runtime input"){if(h(t,e,V,O),!d(t))throw new Error(`${e} must contain an object`);const n=new Set(["context","engineId","environment","fixtures","invocationId","profileId","setupData","taskId","version"]);for(const r of Object.keys(t))if(!n.has(r))throw new Error(`${e} contains unknown field ${r}`);if(t.version!==NODE_VITEST_RUNTIME_INPUT_VERSION)throw new Error(`${e}.version must be 1`);if(t.engineId!=="node-vitest")throw new Error(`${e}.engineId must be "node-vitest"`);if(!A(t.profileId))throw new Error(`${e}.profileId is invalid`);if(!d(t.context)||!d(t.fixtures))throw new Error(`${e} context and fixtures must be objects`);const o=y(t.environment,`${e}.environment`);return _(o),{context:t.context,engineId:"node-vitest",environment:o,fixtures:t.fixtures,invocationId:T(t.invocationId,`${e}.invocationId`),profileId:t.profileId,...Object.hasOwn(t,"setupData")?{setupData:t.setupData}:{},taskId:T(t.taskId,`${e}.taskId`),version:NODE_VITEST_RUNTIME_INPUT_VERSION}}function _(t){const e=Object.entries(t);if(e.length>N)throw new Error(`Node/Vitest forwarded environment exceeds the ${N.toString()} entry limit`);let n=0;const o=new Set;for(const[r,c]of e){D(r,c,"Node/Vitest forwarded environment");const i=r.toUpperCase();if(o.has(i))throw new Error(`Node/Vitest forwarded environment contains case-insensitive duplicate key ${r}`);if(o.add(i),i.startsWith("TESTKIT_")||i.startsWith("VITEST_")||x.has(i))throw new Error(`Node/Vitest forwarded environment contains reserved key ${r}`);n+=Buffer.byteLength(r)+Buffer.byteLength(c)+2}if(n>p)throw new Error(`Node/Vitest forwarded environment exceeds the ${p.toString()} byte limit`)}function y(t,e){if(!d(t))throw new Error(`${e} must be an object`);const n=Object.entries(t);if(!n.every(o=>typeof o[1]=="string"))throw new Error(`${e} values must all be strings`);return Object.fromEntries(n)}function D(t,e,n){if(t.length===0||t.includes("=")||t.includes("\0"))throw new Error(`${n} contains an invalid variable name`);if(e.includes("\0"))throw new Error(`${n}.${t} contains a NUL character`)}function a(t){if(t!==null&&typeof t=="object"&&!Object.isFrozen(t)){Object.freeze(t);for(const e of Object.values(t))a(e)}return t}function T(t,e){if(typeof t!="string"||t.length===0)throw new Error(`${e} must be a non-empty string`);return t}function A(t){return t==="node-vitest-contract"||t==="node-vitest-data"}function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import l from"node:fs/promises";import c from"node:path";import{writeOwnedRuntimeInput as m,ownedRuntimeInputModuleUrl as f}from"../../runtime-input-file.js";import{requireBoundedJsonValue as y,RUNTIME_INPUT_JSON_BOUNDS as h}from"../../contracts/json-bounds.js";import{ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS as g
|
|
1
|
+
import l from"node:fs/promises";import c from"node:path";import{writeOwnedRuntimeInput as m,ownedRuntimeInputModuleUrl as f}from"../../runtime-input-file.js";import{requireBoundedJsonValue as y,RUNTIME_INPUT_JSON_BOUNDS as h}from"../../contracts/json-bounds.js";import{ENGINE_PROCESS_RESERVED_ENVIRONMENT_KEYS as g}from"../../../process/environment.js";import{managedProcessEnvironmentOverlayInstallerSource as w}from"../../../process/environment-overlay.js";export const PLAYWRIGHT_RUNTIME_INPUT_MAX_BYTES=4*1024*1024,PLAYWRIGHT_RUNTIME_ENVIRONMENT_MAX_BYTES=2*1024*1024,PLAYWRIGHT_RUNTIME_ENVIRONMENT_MAX_ENTRIES=512;const d=new Set(["BASE_URL","FORCE_COLOR","NODE_OPTIONS","NO_COLOR","PLAYWRIGHT_BROWSERS_PATH","PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD","TESTKIT_ACTIVE","TESTKIT_INTERNAL_FILE_DEADLINE_MS","TESTKIT_INTERNAL_FILE_TIMEOUT_SECONDS","TESTKIT_INVOCATION_ID","TESTKIT_RUNTIME_ID","TESTKIT_TEST_FILE","TESTKIT_TEST_ID",...g].map(e=>e.toUpperCase())),p={filename:"runtime-input.json",label:"Playwright runtime input",maxSizeBytes:PLAYWRIGHT_RUNTIME_INPUT_MAX_BYTES},E=Symbol.for("@gfdelarue/testkit/playwright-runtime-input/v1");export function readPlaywrightContext(){const e=Reflect.get(globalThis,E);return T(e)?e.context:null}export async function materializePlaywrightRuntimeInput(e){if(!c.isAbsolute(e.directory))throw new Error("Playwright runtime-input directory must be absolute");await l.mkdir(e.directory,{recursive:!0,mode:448}),process.platform!=="win32"&&await l.chmod(e.directory,448);const t=I(e.inputs.environment),r={baseUrl:v(e.baseUrl),endpoints:e.endpoints,engineId:"playwright",environment:t,fixtures:e.inputs.fixtures,invocationId:e.invocationId,managed:!0,schemaVersion:1,taskId:e.taskId,uiConfig:e.inputs.configuration??{},...e.inputs.setupData===void 0?{}:{setupData:e.inputs.setupData}},o=await m(e.directory,r,p);return{digest:o.sha256,file:o.file,sizeBytes:o.sizeBytes}}export function playwrightRuntimeInputBootstrapSource(e){const t=JSON.stringify({digest:e.digest,file:e.file,ownedInput:{directory:c.dirname(e.file),file:e.file,sha256:e.digest,sizeBytes:e.sizeBytes},protocol:p,invocationId:e.invocationId,jsonBounds:h,maximumEnvironmentBytes:PLAYWRIGHT_RUNTIME_ENVIRONMENT_MAX_BYTES,maximumEnvironmentEntries:PLAYWRIGHT_RUNTIME_ENVIRONMENT_MAX_ENTRIES,reservedEnvironmentKeys:[...d],taskId:e.taskId}),n=w(),r=`const requireBoundedJsonValue = (${y.toString()});`;return`
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { readVerifiedOwnedFile } from ${JSON.stringify(f)};
|
|
4
4
|
|
|
@@ -44,12 +44,13 @@ export declare function resolveRuntimeInstanceConfigs<T extends RuntimeServiceCo
|
|
|
44
44
|
runtimeId: string;
|
|
45
45
|
runtimeLabel: string;
|
|
46
46
|
testkit: {
|
|
47
|
+
mode?: string;
|
|
48
|
+
serviceEnv?: Readonly<Record<string, string>>;
|
|
49
|
+
ui?: unknown;
|
|
47
50
|
database: import("../config/loader/database-materialization.js").MaterializedDatabaseConfig<{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
password?: string | undefined;
|
|
52
|
-
user?: string | undefined;
|
|
51
|
+
image?: string;
|
|
52
|
+
password?: string;
|
|
53
|
+
user?: string;
|
|
53
54
|
binding: import("../config/loader/execution-model.js").DatabaseBinding;
|
|
54
55
|
maxConnections: number | undefined;
|
|
55
56
|
reservedConnections: number | undefined;
|
|
@@ -57,6 +58,8 @@ export declare function resolveRuntimeInstanceConfigs<T extends RuntimeServiceCo
|
|
|
57
58
|
roles: import("../config/authoring/index.js").DatabaseRoleConfig[];
|
|
58
59
|
runtimeConnections: number | undefined;
|
|
59
60
|
serviceName: string;
|
|
61
|
+
sourceSchema: import("../config/loader/database.js").NormalizedSourceSchemaConfig | null;
|
|
62
|
+
template: import("../config/loader/database.js").NormalizedDatabaseTemplateConfig;
|
|
60
63
|
}> | undefined;
|
|
61
64
|
prepareDir: string;
|
|
62
65
|
templateContext: {
|
|
@@ -82,13 +85,14 @@ export declare function resolveRuntimeInstanceConfigs<T extends RuntimeServiceCo
|
|
|
82
85
|
databaseBindingsReader: typeof readDatabaseInfo;
|
|
83
86
|
};
|
|
84
87
|
runtime: {
|
|
85
|
-
prepare: import("../steps/build-config.js").NormalizedBuildPrepareConfig;
|
|
86
88
|
build: import("../steps/build-config.js").NormalizedBuildConfig | null;
|
|
87
89
|
instances: number;
|
|
88
90
|
maxConcurrentTasks: number;
|
|
89
91
|
toolchain: import("../toolchains/index.js").NormalizedRuntimeToolchain | null;
|
|
92
|
+
prepare: import("../steps/build-config.js").NormalizedBuildPrepareConfig;
|
|
90
93
|
};
|
|
91
94
|
local: {
|
|
95
|
+
shutdownTimeoutMs?: number;
|
|
92
96
|
start: string;
|
|
93
97
|
cwd: string | undefined;
|
|
94
98
|
port: number | undefined;
|
|
@@ -97,11 +101,7 @@ export declare function resolveRuntimeInstanceConfigs<T extends RuntimeServiceCo
|
|
|
97
101
|
env: {
|
|
98
102
|
[x: string]: string;
|
|
99
103
|
};
|
|
100
|
-
shutdownTimeoutMs?: number;
|
|
101
104
|
} | undefined;
|
|
102
|
-
mode?: string;
|
|
103
|
-
serviceEnv?: Readonly<Record<string, string>>;
|
|
104
|
-
ui?: unknown;
|
|
105
105
|
};
|
|
106
106
|
})[];
|
|
107
107
|
export declare function buildPortMap(runtimeConfigs: readonly RuntimeServiceConfig[], runtimeId: RuntimeIdentifier, namespace?: RuntimePortNamespace): Map<string, number>;
|
|
@@ -110,12 +110,13 @@ export declare function resolveRuntimeConfig<T extends RuntimeServiceConfig>(con
|
|
|
110
110
|
runtimeId: string;
|
|
111
111
|
runtimeLabel: string;
|
|
112
112
|
testkit: {
|
|
113
|
+
mode?: string;
|
|
114
|
+
serviceEnv?: Readonly<Record<string, string>>;
|
|
115
|
+
ui?: unknown;
|
|
113
116
|
database: import("../config/loader/database-materialization.js").MaterializedDatabaseConfig<{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
password?: string | undefined;
|
|
118
|
-
user?: string | undefined;
|
|
117
|
+
image?: string;
|
|
118
|
+
password?: string;
|
|
119
|
+
user?: string;
|
|
119
120
|
binding: import("../config/loader/execution-model.js").DatabaseBinding;
|
|
120
121
|
maxConnections: number | undefined;
|
|
121
122
|
reservedConnections: number | undefined;
|
|
@@ -123,6 +124,8 @@ export declare function resolveRuntimeConfig<T extends RuntimeServiceConfig>(con
|
|
|
123
124
|
roles: import("../config/authoring/index.js").DatabaseRoleConfig[];
|
|
124
125
|
runtimeConnections: number | undefined;
|
|
125
126
|
serviceName: string;
|
|
127
|
+
sourceSchema: import("../config/loader/database.js").NormalizedSourceSchemaConfig | null;
|
|
128
|
+
template: import("../config/loader/database.js").NormalizedDatabaseTemplateConfig;
|
|
126
129
|
}> | undefined;
|
|
127
130
|
prepareDir: string;
|
|
128
131
|
templateContext: {
|
|
@@ -148,13 +151,14 @@ export declare function resolveRuntimeConfig<T extends RuntimeServiceConfig>(con
|
|
|
148
151
|
databaseBindingsReader: typeof readDatabaseInfo;
|
|
149
152
|
};
|
|
150
153
|
runtime: {
|
|
151
|
-
prepare: import("../steps/build-config.js").NormalizedBuildPrepareConfig;
|
|
152
154
|
build: import("../steps/build-config.js").NormalizedBuildConfig | null;
|
|
153
155
|
instances: number;
|
|
154
156
|
maxConcurrentTasks: number;
|
|
155
157
|
toolchain: import("../toolchains/index.js").NormalizedRuntimeToolchain | null;
|
|
158
|
+
prepare: import("../steps/build-config.js").NormalizedBuildPrepareConfig;
|
|
156
159
|
};
|
|
157
160
|
local: {
|
|
161
|
+
shutdownTimeoutMs?: number;
|
|
158
162
|
start: string;
|
|
159
163
|
cwd: string | undefined;
|
|
160
164
|
port: number | undefined;
|
|
@@ -163,11 +167,7 @@ export declare function resolveRuntimeConfig<T extends RuntimeServiceConfig>(con
|
|
|
163
167
|
env: {
|
|
164
168
|
[x: string]: string;
|
|
165
169
|
};
|
|
166
|
-
shutdownTimeoutMs?: number;
|
|
167
170
|
} | undefined;
|
|
168
|
-
mode?: string;
|
|
169
|
-
serviceEnv?: Readonly<Record<string, string>>;
|
|
170
|
-
ui?: unknown;
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
173
|
export declare function resolveServiceStateDir(runtimeDir: string, config: Pick<ExecutionEnvironmentConfig, "name">): string;
|