Skip to content
Myr

index.test.ts

This file

Path

runtime-tests/workerd/index.test.ts

62 lines · 1.6 KiB · TypeScript

Last changed by

test: move adapter runtime tests into `adapters/*` (#5466)Yusuke Wadabefore adoption645ddd6

History of this file

Take it

The walk stopped after 200 commits: lines older than f0b094d point at it.

Merge commit from forkYusuke Wadabefore adoptionf0b094d

lines 1–11why, one step back
1import { unstable_dev } from 'wrangler'
2import type { Unstable_DevWorker } from 'wrangler'34describe('workerd', () => {5 let worker: Unstable_DevWorker67 beforeAll(async () => {8 worker = await unstable_dev('./runtime-tests/workerd/index.ts', {9 vars: {10 NAME: 'Hono',11 },

test(workerd): add `compatibilityDate` (#5100)Yusuke Wadabefore adoptionba89e97

line 12why, one step back
12 compatibilityDate: '2026-07-01',

Merge commit from forkYusuke Wadabefore adoptionf0b094d

lines 13–47why, one step back
13 experimental: { disableExperimentalWarning: true },
14 })15 })1617 afterAll(async () => {18 await worker.stop()19 })2021 it('Should return 200 response with the runtime key', async () => {22 const res = await worker.fetch('/')23 expect(res.status).toBe(200)24 expect(await res.text()).toBe('Hello from workerd')25 })2627 it('Should return 200 response with the environment variable', async () => {28 const res = await worker.fetch('/env')29 expect(res.status).toBe(200)30 expect(await res.text()).toBe('Hono')31 })3233 it('Should return 200 response with the true message', async () => {34 const res = await worker.fetch('/color')35 expect(res.status).toBe(200)36 expect(await res.text()).toBe('True')37 })38})3940describe('workerd with NO_COLOR', () => {41 let worker: Unstable_DevWorker4243 beforeAll(async () => {44 worker = await unstable_dev('./runtime-tests/workerd/index.ts', {45 vars: {46 NO_COLOR: true,47 },

test(workerd): add `compatibilityDate` (#5100)Yusuke Wadabefore adoptionba89e97

line 48why, one step back
48 compatibilityDate: '2026-07-01',

Merge commit from forkYusuke Wadabefore adoptionf0b094d

lines 49–62why, one step back
49 experimental: { disableExperimentalWarning: true },
50 })51 })5253 afterAll(async () => {54 await worker.stop()55 })5657 it('Should return 200 response with the false message', async () => {58 const res = await worker.fetch('/color')59 expect(res.status).toBe(200)60 expect(await res.text()).toBe('False')61 })62})