MCPcopy Index your code
hub / github.com/TanStack/ai / buildWorkerScript

Function buildWorkerScript

testing/e2e/tests/workerd-console-logger.spec.ts:38–55  ·  view source on GitHub ↗

* Build a single-module worker script: the compiled ConsoleLogger source * (self-contained, no imports) plus a fetch handler that exercises it.

()

Source from the content-addressed store, hash-verified

36 * (self-contained, no imports) plus a fetch handler that exercises it.
37 */
38async function buildWorkerScript(): Promise<string> {
39 const loggerSource = await readFile(LOGGER_DIST, 'utf8')
40 return `${loggerSource}
41export default {
42 fetch() {
43 const logger = new ConsoleLogger()
44 logger.debug('E2E-DEBUG-HEADLINE', {
45 payload: { nested: { deeper: { deepest: { marker: 'E2E-META-DEPTH-5' } } } },
46 })
47 logger.error('E2E-ERROR-HEADLINE', { cause: new Error('E2E-UPSTREAM-401') })
48 const circular = { name: 'E2E-CIRCULAR' }
49 circular.self = circular
50 logger.warn('E2E-WARN-HEADLINE', circular)
51 return new Response('ok')
52 },
53}
54`
55}
56
57test.describe('ConsoleLogger on real workerd', () => {
58 test('meta payloads reach the log stream at full depth', async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected