-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Document adminSecretsStore() in cloudflare:test for vitest-pool-workers #29388
Copy link
Copy link
Open
Labels
product:workersRelated to Workers productRelated to Workers product
Description
Summary
@cloudflare/vitest-pool-workers is adding a new adminSecretsStore() export to cloudflare:test (cloudflare/workers-sdk#13073). This gives tests write access to secrets store bindings, which are otherwise read-only (.get() only).
Usage
import { adminSecretsStore } from "cloudflare:test";
import { env } from "cloudflare:workers";
const admin = adminSecretsStore(env.MY_SECRET);
await admin.create("test-value");
const value = await env.MY_SECRET.get(); // "test-value"Admin API methods
create(value: string): Promise<string>— create a secret, returns its IDupdate(value: string, id: string): Promise<string>— update a secret by IDduplicate(id: string, newName: string): Promise<string>— duplicate a secret under a new namedelete(id: string): Promise<void>— delete a secret by IDlist(): Promise<{ name: string; metadata?: { uuid: string } }[]>— list all secretsget(id: string): Promise<string>— get a secret's name by ID
Where to document
This should be added to the vitest-pool-workers testing documentation, likely alongside the existing applyD1Migrations() documentation as another binding-seeding helper.
Reactions are currently unavailable
Metadata
Metadata
Labels
product:workersRelated to Workers productRelated to Workers product