testing/cross_backend/build_test_backend_paths.ts

Per-backend filesystem layout under os.tmpdir() for cross-process tests.

Isolation matters because vitest projects can run in parallel, and other repos' cross runs on the same machine share os.tmpdir() — a shared root would mix bootstrap and daemon tokens across concurrently-running backends. Each backend gets its own subtree: default_test_backend_paths (what the default builders use) names it after the running repo's directory plus the backend name, so two repos that both name a backend 'rust' don't collide; build_test_backend_paths takes an explicit, already-unique prefix.

Consumers compose: take the generic paths from either builder and add domain-specific dirs (e.g. zzz_dir, scoped_dir) under the returned root.

view source

Declarations
#

4 declarations

build_test_backend_paths
#

testing/cross_backend/build_test_backend_paths.ts view source

(prefix: string): TestBackendPaths import {build_test_backend_paths} from '@fuzdev/fuz_app/testing/cross_backend/build_test_backend_paths.js';

Build the generic path layout for a cross-process test backend under os.tmpdir()/<prefix>. prefix must be unique across every repo that runs cross tests on the machine (e.g. 'my_app_cross_rust'); for a default derived from the backend name, use default_test_backend_paths.

prefix

type string

returns

TestBackendPaths

default_test_backend_paths
#

testing/cross_backend/build_test_backend_paths.ts view source

(name: string): TestBackendPaths import {default_test_backend_paths} from '@fuzdev/fuz_app/testing/cross_backend/build_test_backend_paths.js';

The generic path layout under the default, repo-namespaced prefix (default_test_backend_prefix) — what the default backend builders use when given no paths.

name

the backend name (BackendConfig.name)

type string

returns

TestBackendPaths

default_test_backend_prefix
#

testing/cross_backend/build_test_backend_paths.ts view source

(name: string): string import {default_test_backend_prefix} from '@fuzdev/fuz_app/testing/cross_backend/build_test_backend_paths.js';

The default per-backend tmpdir prefix: the running repo's directory name (process.cwd()'s basename — so run the tests from the repo root) plus the backend name, so the same backend name in two repos ('rust' in each) lands in two directories.

name

the backend name (BackendConfig.name)

type string

returns

string

TestBackendPaths
#

testing/cross_backend/build_test_backend_paths.ts view source

TestBackendPaths import type {TestBackendPaths} from '@fuzdev/fuz_app/testing/cross_backend/build_test_backend_paths.js';

Generic per-backend paths every cross-process test binary needs. Consumers extend this with their own domain paths.

  • root — the per-backend subtree under os.tmpdir(). Compose consumer-specific paths under here.
  • bootstrap_token_path — FUZ_BOOTSTRAP_TOKEN_PATH; harness writes the bootstrap token here before spawn.
  • daemon_token_path — where init_daemon_token (Rust) and the TS server's daemon-token writer land the token (under {root}/run/); spawn_backend deletes it before each spawn, so a token a previous run left is never read.

root

type string

readonly

bootstrap_token_path

type string

readonly

daemon_token_path

type string

readonly

Depends on
#

Imported by
#