stricttest v0.2.0 /typescript/src/index
On this page

The stricttest npm package's public surface: an always-on test-isolation floor for Node suites, bound per test through node:test's TestContext.

#typescript/src/index

#typescript/src/index

stricttest -- an always-on test-isolation floor for Node suites.

The composite entry point is {@link isolate}: one call at the top of a test (or of a helper every test in the file funnels through) binds the whole floor. Each piece is exported on its own too -- {@link throwawayHome}, {@link isolateGitConfig}, {@link lockdownTransports}, {@link stripCredentials} -- for suites that need one guarantee without the others. {@link chdir} is separate on purpose: it is a per-test tool, not part of the floor.

#Contract

Every helper takes a per-test cleanup registry -- node:test's TestContext satisfies it directly -- and undoes itself when that test finishes. Nothing here is process-wide or permanent: the isolation lives exactly as long as the test (or subtest) whose context was passed in.

#Concurrency

HOME, the working directory and the git identity belong to the process, not to a test. Nested tests are fine (a subtest starts and finishes inside its parent), but two tests isolating at the same time is not, and this package detects it rather than letting one test's HOME leak into another's: a test that finishes its isolation while another's is still open fails with an explanatory error. Run the tests in an isolating file sequentially.

#chdir

TS typescript
export { chdir }

#CREDENTIAL_VARS

TS typescript
export { CREDENTIAL_VARS }

#IDENTITY_EMAIL

TS typescript
export { IDENTITY_EMAIL }

#IDENTITY_NAME

TS typescript
export { IDENTITY_NAME }

#isolateGitConfig

TS typescript
export { isolateGitConfig }

#lockdownTransports

TS typescript
export { lockdownTransports }

#stripCredentials

TS typescript
export { stripCredentials }

#throwawayHome

TS typescript
export { throwawayHome }

#isolate

TS typescript
export { isolate }

#type IsolateOptions

TS typescript
export { type IsolateOptions }

#KNOWN_VARS

TS typescript
export { KNOWN_VARS }

#type KnownVar

TS typescript
export { type KnownVar }

#preserveVars

TS typescript
export { preserveVars }

#DEFAULT_RUNNER_COMMAND

TS typescript
export { DEFAULT_RUNNER_COMMAND }

#DEFAULT_SANDBOX_ENV

TS typescript
export { DEFAULT_SANDBOX_ENV }

#insideSandbox

TS typescript
export { insideSandbox }

#requireSandbox

TS typescript
export { requireSandbox }

#type RequireSandboxOptions

TS typescript
export { type RequireSandboxOptions }

#SandboxRequiredError

TS typescript
export { SandboxRequiredError }

#type SandboxPolicy

TS typescript
export { type SandboxPolicy }
Search