Skip to content

Commit f634c82

Browse files
authored
test(workerd): rename the runtime test wrangler to workerd (#2888)
* test(workerd): rename the runtime test `wrangler` to `workerd` * fixed ci.yml * fixed a typo * use node 20.x
1 parent eb3d856 commit f634c82

File tree

7 files changed

+103
-84
lines changed

7 files changed

+103
-84
lines changed

.github/workflows/ci.yml

+8-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- main
2222
- fastly
2323
- node
24-
- wrangler
24+
- workerd
2525
- lambda
2626
- lambda-edge
2727
steps:
@@ -129,18 +129,21 @@ jobs:
129129
name: coverage-node
130130
path: coverage/
131131

132-
wrangler:
133-
name: 'Cloudflare Workers'
132+
workerd:
133+
name: 'workerd'
134134
runs-on: ubuntu-latest
135135
steps:
136136
- uses: actions/checkout@v4
137+
- uses: actions/setup-node@v4
138+
with:
139+
node-version: '20.x'
137140
- uses: oven-sh/setup-bun@v1
138141
- run: bun install
139142
- run: bun run build
140-
- run: bun run test:wrangler
143+
- run: bun run test:workerd
141144
- uses: actions/upload-artifact@v4
142145
with:
143-
name: coverage-wrangler
146+
name: coverage-workerd
144147
path: coverage/
145148

146149
lambda:

bun.lockb

880 Bytes
Binary file not shown.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"test:bun": "bun test --jsx-import-source ../../src/jsx runtime_tests/bun/index.test.tsx",
1717
"test:fastly": "vitest --run --config ./runtime_tests/fastly/vitest.config.ts",
1818
"test:node": "vitest --run --config ./runtime_tests/node/vitest.config.ts",
19-
"test:wrangler": "vitest --run --config ./runtime_tests/wrangler/vitest.config.ts",
19+
"test:workerd": "vitest --run --config ./runtime_tests/workerd/vitest.config.ts",
2020
"test:lambda": "vitest --run --config ./runtime_tests/lambda/vitest.config.ts",
2121
"test:lambda-edge": "vitest --run --config ./runtime_tests/lambda-edge/vitest.config.ts",
22-
"test:all": "bun run test && bun test:deno && bun test:bun && bun test:fastly && bun test:node && bun test:wrangler && bun test:lambda && bun test:lambda-edge",
22+
"test:all": "bun run test && bun test:deno && bun test:bun && bun test:fastly && bun test:node && bun test:workerd && bun test:lambda && bun test:lambda-edge",
2323
"lint": "eslint --ext js,ts,tsx src runtime_tests",
2424
"lint:fix": "eslint --ext js,ts,tsx src runtime_tests --fix",
2525
"format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
@@ -593,10 +593,10 @@
593593
"typescript": "^5.3.3",
594594
"vite-plugin-fastly-js-compute": "^0.4.2",
595595
"vitest": "^1.2.2",
596-
"wrangler": "3.17.1",
596+
"wrangler": "^3.58.0",
597597
"zod": "^3.20.2"
598598
},
599599
"engines": {
600600
"node": ">=16.0.0"
601601
}
602-
}
602+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { unstable_dev } from 'wrangler'
22
import type { UnstableDevWorker } from 'wrangler'
33

4-
describe('Wrangler', () => {
4+
describe('workerd', () => {
55
let worker: UnstableDevWorker
66

77
beforeAll(async () => {
8-
worker = await unstable_dev('./runtime_tests/wrangler/index.ts', {
8+
worker = await unstable_dev('./runtime_tests/workerd/index.ts', {
99
vars: {
10-
NAME: 'Cloudflare',
10+
NAME: 'Hono',
1111
},
1212
experimental: { disableExperimentalWarning: true },
1313
})
@@ -17,15 +17,15 @@ describe('Wrangler', () => {
1717
await worker.stop()
1818
})
1919

20-
it('Should return Hello World', async () => {
20+
it('Should return 200 response with the runtime key', async () => {
2121
const res = await worker.fetch('/')
2222
expect(res.status).toBe(200)
23-
expect(await res.text()).toBe('Hello Wrangler!')
23+
expect(await res.text()).toBe('Hello from workerd')
2424
})
2525

26-
it('Should return the environment variable', async () => {
26+
it('Should return 200 response with the environment variable', async () => {
2727
const res = await worker.fetch('/env')
2828
expect(res.status).toBe(200)
29-
expect(await res.text()).toBe('Cloudflare')
29+
expect(await res.text()).toBe('Hono')
3030
})
3131
})

runtime_tests/wrangler/index.ts renamed to runtime_tests/workerd/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { env } from '../../src/helper/adapter'
1+
import { env, getRuntimeKey } from '../../src/helper/adapter'
22
import { Hono } from '../../src/hono'
33

44
const app = new Hono()
55

6-
app.get('/', (c) => c.text('Hello Wrangler!'))
6+
app.get('/', (c) => c.text(`Hello from ${getRuntimeKey()}`))
77

88
app.get('/env', (c) => {
99
const { NAME } = env<{ NAME: string }>(c)

runtime_tests/wrangler/vitest.config.ts renamed to runtime_tests/workerd/vitest.config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import config from '../../vitest.config'
55
export default defineConfig({
66
test: {
77
globals: true,
8-
include: ['**/runtime_tests/wrangler/**/(*.)+(test).+(ts|tsx)'],
9-
exclude: ['**/runtime_tests/wrangler/vitest.config.ts'],
8+
include: ['**/runtime_tests/workerd/**/(*.)+(test).+(ts|tsx)'],
9+
exclude: ['**/runtime_tests/workerd/vitest.config.ts'],
1010
coverage: {
1111
...config.test?.coverage,
12-
reportsDirectory: './coverage/raw/runtime-wrangler',
12+
reportsDirectory: './coverage/raw/runtime-workerd',
1313
},
1414
},
1515
})

yarn.lock

+79-63
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
22
# yarn lockfile v1
3-
# bun ./bun.lockb --hash: 73AD072D7FA73F03-dcb20bf842c8e7ce-4D383E11F2747669-a2b8c480fbdb7c0d
3+
# bun ./bun.lockb --hash: BAD784DA2D3E8912-7bb272adaca1c26f-B77747473A8BC735-f20e673ef1d530e3
44

55

66
"@aashutoshrathi/word-wrap@^1.2.3":
@@ -141,37 +141,44 @@
141141
resolved "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-3.0.1.tgz"
142142
integrity sha512-ycd38sx1UTZpHZwh8IfH/4N3n0OQUB8awxkUSLXf9PolEd088YbxoPB3noHy4E+L2oYN7KZMrg9517pX0z2RhQ==
143143

144-
"@cloudflare/kv-asset-handler@^0.2.0":
145-
version "0.2.0"
146-
resolved "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz"
147-
integrity sha512-MVbXLbTcAotOPUj0pAMhVtJ+3/kFkwJqc5qNOleOZTv6QkZZABDMS21dSrSlVswEHwrpWC03e4fWytjqKvuE2A==
144+
"@cloudflare/kv-asset-handler@0.3.2":
145+
version "0.3.2"
146+
resolved "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.2.tgz"
147+
integrity sha512-EeEjMobfuJrwoctj7FA1y1KEbM0+Q1xSjobIEyie9k4haVEBB7vkDvsasw1pM3rO39mL2akxIAzLMUAtrMHZhA==
148148
dependencies:
149149
mime "^3.0.0"
150150

151-
"@cloudflare/workerd-darwin-64@1.20231030.0":
152-
version "1.20231030.0"
153-
resolved "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20231030.0.tgz"
154-
integrity sha512-J4PQ9utPxLya9yHdMMx3AZeC5M/6FxcoYw6jo9jbDDFTy+a4Gslqf4Im9We3aeOEdPXa3tgQHVQOSelJSZLhIw==
151+
"@cloudflare/workerd-darwin-64@1.20240524.0":
152+
version "1.20240524.0"
153+
resolved "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240524.0.tgz"
154+
integrity sha512-ATaXjefbTsrv4mpn4Fdua114RRDXcX5Ky+Mv+f4JTUllgalmqC4CYMN4jxRz9IpJU/fNMN8IEfvUyuJBAcl9Iw==
155155

156-
"@cloudflare/workerd-darwin-arm64@1.20231030.0":
157-
version "1.20231030.0"
158-
resolved "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20231030.0.tgz"
159-
integrity sha512-WSJJjm11Del4hSneiNB7wTXGtBXI4QMCH9l5qf4iT5PAW8cESGcCmdHtWDWDtGAAGcvmLT04KNvmum92vRKKQQ==
156+
"@cloudflare/workerd-darwin-arm64@1.20240524.0":
157+
version "1.20240524.0"
158+
resolved "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240524.0.tgz"
159+
integrity sha512-wnbsZI4CS0QPCd+wnBHQ40C28A/2Qo4ESi1YhE2735G3UNcc876MWksZhsubd+XH0XPIra6eNFqyw6wRMpQOXA==
160160

161-
"@cloudflare/workerd-linux-64@1.20231030.0":
162-
version "1.20231030.0"
163-
resolved "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20231030.0.tgz"
164-
integrity sha512-2HUeRTvoCC17fxE0qdBeR7J9dO8j4A8ZbdcvY8pZxdk+zERU6+N03RTbk/dQMU488PwiDvcC3zZqS4gwLfVT8g==
161+
"@cloudflare/workerd-linux-64@1.20240524.0":
162+
version "1.20240524.0"
163+
resolved "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240524.0.tgz"
164+
integrity sha512-E8mj+HPBryKwaJAiNsYzXtVjKCL0KvUBZbtxJxlWM4mLSQhT+uwGT3nydb/hFY59rZnQgZslw0oqEWht5TEYiQ==
165165

166-
"@cloudflare/workerd-linux-arm64@1.20231030.0":
167-
version "1.20231030.0"
168-
resolved "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20231030.0.tgz"
169-
integrity sha512-4/GK5zHh+9JbUI6Z5xTCM0ZmpKKHk7vu9thmHjUxtz+o8Ne9DoD7DlDvXQWgMF6XGaTubDWyp3ttn+Qv8jDFuQ==
166+
"@cloudflare/workerd-linux-arm64@1.20240524.0":
167+
version "1.20240524.0"
168+
resolved "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240524.0.tgz"
169+
integrity sha512-/Fr1W671t2triNCDCBWdStxngnbUfZunZ/2e4kaMLzJDJLYDtYdmvOUCBDzUD4ssqmIMbn9RCQQ0U+CLEoqBqw==
170170

171-
"@cloudflare/[email protected]":
172-
version "1.20231030.0"
173-
resolved "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20231030.0.tgz"
174-
integrity sha512-fb/Jgj8Yqy3PO1jLhk7mTrHMkR8jklpbQFud6rL/aMAn5d6MQbaSrYOCjzkKGp0Zng8D2LIzSl+Fc0C9Sggxjg==
171+
"@cloudflare/[email protected]":
172+
version "1.20240524.0"
173+
resolved "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240524.0.tgz"
174+
integrity sha512-G+ThDEx57g9mAEKqhWnHaaJgpeGYtyhkmwM/BDpLqPks/rAY5YEfZbY4YL1pNk1kkcZDXGrwIsY8xe9Apf5JdA==
175+
176+
"@cspotcode/[email protected]":
177+
version "0.8.1"
178+
resolved "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz"
179+
integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==
180+
dependencies:
181+
"@jridgewell/trace-mapping" "0.3.9"
175182

176183
"@esbuild-plugins/node-globals-polyfill@^0.2.3":
177184
version "0.2.3"
@@ -566,7 +573,7 @@
566573
"@jridgewell/sourcemap-codec" "^1.4.10"
567574
"@jridgewell/trace-mapping" "^0.3.9"
568575

569-
"@jridgewell/resolve-uri@^3.1.0":
576+
"@jridgewell/resolve-uri@^3.0.3", "@jridgewell/resolve-uri@^3.1.0":
570577
version "3.1.1"
571578
resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz"
572579
integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==
@@ -589,6 +596,14 @@
589596
resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz"
590597
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
591598

599+
"@jridgewell/[email protected]":
600+
version "0.3.9"
601+
resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz"
602+
integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==
603+
dependencies:
604+
"@jridgewell/resolve-uri" "^3.0.3"
605+
"@jridgewell/sourcemap-codec" "^1.4.10"
606+
592607
"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.9":
593608
version "0.3.22"
594609
resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz"
@@ -3984,20 +3999,20 @@ min-indent@^1.0.0:
39843999
resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz"
39854000
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
39864001

3987-
miniflare@3.20231030.1:
3988-
version "3.20231030.1"
3989-
resolved "https://registry.npmjs.org/miniflare/-/miniflare-3.20231030.1.tgz"
3990-
integrity sha512-Y+EkgV/aFg/3Y/xfFtImK36sLZGXvNS45avVEz0cUCA2pGpg4hGdPu1Udmz5b06SyeUEFVf/dEDMJwdRYVEgLw==
4002+
miniflare@3.20240524.1:
4003+
version "3.20240524.1"
4004+
resolved "https://registry.npmjs.org/miniflare/-/miniflare-3.20240524.1.tgz"
4005+
integrity sha512-5d3pRxvd5pT7lX1SsBH9+AjXuyHJnChSNOnYhubfi7pxMek4ZfULwhnUmNUp1R7b2xKuzqdFDZa0fsZuUoFxlw==
39914006
dependencies:
4007+
"@cspotcode/source-map-support" "0.8.1"
39924008
acorn "^8.8.0"
39934009
acorn-walk "^8.2.0"
39944010
capnp-ts "^0.7.0"
39954011
exit-hook "^2.2.1"
39964012
glob-to-regexp "^0.4.1"
3997-
source-map-support "0.5.21"
39984013
stoppable "^1.1.0"
3999-
undici "^5.22.1"
4000-
workerd "1.20231030.0"
4014+
undici "^5.28.2"
4015+
workerd "1.20240524.0"
40014016
ws "^8.11.0"
40024017
youch "^3.2.2"
40034018
zod "^3.20.6"
@@ -4878,7 +4893,7 @@ requires-port@^1.0.0:
48784893
resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz"
48794894
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==
48804895

4881-
resolve@^1.10.0, resolve@^1.10.1, resolve@^1.22.4:
4896+
resolve@^1.10.0, resolve@^1.10.1, resolve@^1.22.4, resolve@^1.22.8:
48824897
version "1.22.8"
48834898
resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz"
48844899
integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==
@@ -5189,7 +5204,7 @@ source-map-js@^1.0.2:
51895204
resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz"
51905205
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==
51915206

5192-
source-map-support@0.5.21, source-map-support@~0.5.20:
5207+
source-map-support@~0.5.20:
51935208
version "0.5.21"
51945209
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz"
51955210
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
@@ -5741,7 +5756,7 @@ unbox-primitive@^1.0.2:
57415756
has-symbols "^1.0.3"
57425757
which-boxed-primitive "^1.0.2"
57435758

5744-
undici@^5.22.1:
5759+
undici@^5.28.2:
57455760
version "5.28.2"
57465761
resolved "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz"
57475762
integrity sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==
@@ -6010,38 +6025,39 @@ widest-line@^3.1.0:
60106025
dependencies:
60116026
string-width "^4.0.0"
60126027

6013-
workerd@1.20231030.0:
6014-
version "1.20231030.0"
6015-
resolved "https://registry.npmjs.org/workerd/-/workerd-1.20231030.0.tgz"
6016-
integrity sha512-+FSW+d31f8RrjHanFf/R9A+Z0csf3OtsvzdPmAKuwuZm/5HrBv83cvG9fFeTxl7/nI6irUUXIRF9xcj/NomQzQ==
6028+
workerd@1.20240524.0:
6029+
version "1.20240524.0"
6030+
resolved "https://registry.npmjs.org/workerd/-/workerd-1.20240524.0.tgz"
6031+
integrity sha512-LWLe5D8PVHBcqturmBbwgI71r7YPpIMYZoVEH6S4G35EqIJ55cb0n3FipoSyraoIfpcCxCFxX1K6WsRHbP3pFA==
60176032
optionalDependencies:
6018-
"@cloudflare/workerd-darwin-arm64" "1.20231030.0"
6019-
"@cloudflare/workerd-darwin-64" "1.20231030.0"
6020-
"@cloudflare/workerd-linux-arm64" "1.20231030.0"
6021-
"@cloudflare/workerd-linux-64" "1.20231030.0"
6022-
"@cloudflare/workerd-windows-64" "1.20231030.0"
6023-
6024-
6025-
version "3.17.1"
6026-
resolved "https://registry.npmjs.org/wrangler/-/wrangler-3.17.1.tgz"
6027-
integrity sha512-Pr9+/tjFkthzG63uoVm1NtVvgokT6p92fy1UsOgrntHyTu0pZMC1VJzG0NC8Vhs+z/+yTT8AqVV6AiJb3w8ZOQ==
6028-
dependencies:
6029-
"@cloudflare/kv-asset-handler" "^0.2.0"
6030-
"@esbuild-plugins/node-globals-polyfill" "^0.2.3"
6031-
"@esbuild-plugins/node-modules-polyfill" "^0.2.2"
6032-
blake3-wasm "^2.1.5"
6033-
chokidar "^3.5.3"
6034-
esbuild "0.17.19"
6033+
"@cloudflare/workerd-darwin-arm64" "1.20240524.0"
6034+
"@cloudflare/workerd-darwin-64" "1.20240524.0"
6035+
"@cloudflare/workerd-linux-arm64" "1.20240524.0"
6036+
"@cloudflare/workerd-linux-64" "1.20240524.0"
6037+
"@cloudflare/workerd-windows-64" "1.20240524.0"
6038+
6039+
wrangler@^3.58.0:
6040+
version "3.58.0"
6041+
resolved "https://registry.npmjs.org/wrangler/-/wrangler-3.58.0.tgz"
6042+
integrity sha512-h9gWER7LXLnmHABDNP1p3aqXtchlvSBN8Dp22ZurnkxaLMZ3L3H1Ze1ftiFSs0VRWv0BUnz7AWIUqZmzuBY4Nw==
6043+
dependencies:
60356044
nanoid "^3.3.3"
6036-
path-to-regexp "^6.2.0"
6037-
resolve.exports "^2.0.2"
6045+
esbuild "0.17.19"
6046+
resolve "^1.22.8"
6047+
chokidar "^3.5.3"
6048+
optionalDependencies:
6049+
fsevents "~2.3.2"
6050+
dependencies:
6051+
miniflare "3.20240524.1"
60386052
selfsigned "^2.0.1"
60396053
source-map "0.6.1"
6040-
source-map-support "0.5.21"
6054+
blake3-wasm "^2.1.5"
60416055
xxhash-wasm "^1.0.1"
6042-
miniflare "3.20231030.1"
6043-
optionalDependencies:
6044-
fsevents "~2.3.2"
6056+
path-to-regexp "^6.2.0"
6057+
resolve.exports "^2.0.2"
6058+
"@cloudflare/kv-asset-handler" "0.3.2"
6059+
"@esbuild-plugins/node-globals-polyfill" "^0.2.3"
6060+
"@esbuild-plugins/node-modules-polyfill" "^0.2.2"
60456061

60466062
wrap-ansi@^3.0.1:
60476063
version "3.0.1"

0 commit comments

Comments
 (0)