70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
27 lines
981 B
TypeScript
27 lines
981 B
TypeScript
import { initDeployHelpersContext } from "@cloudflare/deploy-helpers";
|
|
import { logger } from "@cloudflare/deploy-helpers/context";
|
|
import { describe, it } from "vitest";
|
|
|
|
describe("context singleton", () => {
|
|
// Verifies that both package entry points (. and ./context) share the same
|
|
// context module. This only holds if tsup's splitting is enabled — if it's
|
|
// disabled, each entry bundles its own copy and this test will fail.
|
|
it("init from main entry propagates to context entry", ({ expect }) => {
|
|
const mockLogger = { debug: () => {}, log: () => {} };
|
|
|
|
initDeployHelpersContext({
|
|
logger: mockLogger as never,
|
|
fetchResult: (() => {}) as never,
|
|
fetchListResult: (() => {}) as never,
|
|
fetchPagedListResult: (() => {}) as never,
|
|
fetchKVGetValue: (() => {}) as never,
|
|
confirm: (() => {}) as never,
|
|
prompt: (() => {}) as never,
|
|
select: (() => {}) as never,
|
|
isNonInteractiveOrCI: () => false,
|
|
});
|
|
|
|
expect(logger).toBe(mockLogger);
|
|
});
|
|
});
|