Skip to content

waygraph / keys

Function: keys() ​

keys(namespace): <T>(stubs?) => KeyNamespace<T>

Defined in: src/engine/mem/mem.ts:46

Declares the Mem keys of one namespace in one line: a type, whose property names become the keys ("<namespace>.<field>", the name --data and the run log use). Each property is one key, the same object every time it is read - Mem stores values by key. A key can carry the fake value a run gets when none is given: unique is a token new every run, so what a run creates doesn't collide with an earlier run's.

Parameters ​

namespace ​

string

Returns ​

<T>(stubs?) => KeyNamespace<T>

Example ​

ts
export const SaucedemoKeys = keys("saucedemo")<{ credentials: { username: string; password: string } }>({
  credentials: () => ({ username: "standard_user", password: "secret_sauce" }),
});
mem.set(SaucedemoKeys.credentials, { username: "standard_user", password: "secret_sauce" });
requires: [SaucedemoKeys.credentials]

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed