Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(workerd): rename the runtime test wrangler to workerd #2888

Merged
merged 4 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- main
- fastly
- node
- wrangler
- workerd
- lambda
- lambda-edge
steps:
Expand Down Expand Up @@ -129,18 +129,21 @@ jobs:
name: coverage-node
path: coverage/

wrangler:
name: 'Cloudflare Workers'
workerd:
name: 'workerd'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
- run: bun run test:wrangler
- run: bun run test:workerd
- uses: actions/upload-artifact@v4
with:
name: coverage-wrangler
name: coverage-workerd
path: coverage/

lambda:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"test:bun": "bun test --jsx-import-source ../../src/jsx runtime_tests/bun/index.test.tsx",
"test:fastly": "vitest --run --config ./runtime_tests/fastly/vitest.config.ts",
"test:node": "vitest --run --config ./runtime_tests/node/vitest.config.ts",
"test:wrangler": "vitest --run --config ./runtime_tests/wrangler/vitest.config.ts",
"test:workerd": "vitest --run --config ./runtime_tests/workerd/vitest.config.ts",
"test:lambda": "vitest --run --config ./runtime_tests/lambda/vitest.config.ts",
"test:lambda-edge": "vitest --run --config ./runtime_tests/lambda-edge/vitest.config.ts",
"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",
"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",
"lint": "eslint --ext js,ts,tsx src runtime_tests",
"lint:fix": "eslint --ext js,ts,tsx src runtime_tests --fix",
"format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"",
Expand Down Expand Up @@ -593,10 +593,10 @@
"typescript": "^5.3.3",
"vite-plugin-fastly-js-compute": "^0.4.2",
"vitest": "^1.2.2",
"wrangler": "3.17.1",
"wrangler": "^3.58.0",
"zod": "^3.20.2"
},
"engines": {
"node": ">=16.0.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { unstable_dev } from 'wrangler'
import type { UnstableDevWorker } from 'wrangler'

describe('Wrangler', () => {
describe('workerd', () => {
let worker: UnstableDevWorker

beforeAll(async () => {
worker = await unstable_dev('./runtime_tests/wrangler/index.ts', {
worker = await unstable_dev('./runtime_tests/workerd/index.ts', {
vars: {
NAME: 'Cloudflare',
NAME: 'Hono',
},
experimental: { disableExperimentalWarning: true },
})
Expand All @@ -17,15 +17,15 @@ describe('Wrangler', () => {
await worker.stop()
})

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

it('Should return the environment variable', async () => {
it('Should return 200 response with the environment variable', async () => {
const res = await worker.fetch('/env')
expect(res.status).toBe(200)
expect(await res.text()).toBe('Cloudflare')
expect(await res.text()).toBe('Hono')
})
})
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { env } from '../../src/helper/adapter'
import { env, getRuntimeKey } from '../../src/helper/adapter'
import { Hono } from '../../src/hono'

const app = new Hono()

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

app.get('/env', (c) => {
const { NAME } = env<{ NAME: string }>(c)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import config from '../../vitest.config'
export default defineConfig({
test: {
globals: true,
include: ['**/runtime_tests/wrangler/**/(*.)+(test).+(ts|tsx)'],
exclude: ['**/runtime_tests/wrangler/vitest.config.ts'],
include: ['**/runtime_tests/workerd/**/(*.)+(test).+(ts|tsx)'],
exclude: ['**/runtime_tests/workerd/vitest.config.ts'],
coverage: {
...config.test?.coverage,
reportsDirectory: './coverage/raw/runtime-wrangler',
reportsDirectory: './coverage/raw/runtime-workerd',
},
},
})
142 changes: 79 additions & 63 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
# bun ./bun.lockb --hash: 73AD072D7FA73F03-dcb20bf842c8e7ce-4D383E11F2747669-a2b8c480fbdb7c0d
# bun ./bun.lockb --hash: BAD784DA2D3E8912-7bb272adaca1c26f-B77747473A8BC735-f20e673ef1d530e3


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

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

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

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

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

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

"@cloudflare/[email protected]":
version "1.20231030.0"
resolved "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20231030.0.tgz"
integrity sha512-fb/Jgj8Yqy3PO1jLhk7mTrHMkR8jklpbQFud6rL/aMAn5d6MQbaSrYOCjzkKGp0Zng8D2LIzSl+Fc0C9Sggxjg==
"@cloudflare/[email protected]":
version "1.20240524.0"
resolved "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240524.0.tgz"
integrity sha512-G+ThDEx57g9mAEKqhWnHaaJgpeGYtyhkmwM/BDpLqPks/rAY5YEfZbY4YL1pNk1kkcZDXGrwIsY8xe9Apf5JdA==

"@cspotcode/[email protected]":
version "0.8.1"
resolved "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz"
integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==
dependencies:
"@jridgewell/trace-mapping" "0.3.9"

"@esbuild-plugins/node-globals-polyfill@^0.2.3":
version "0.2.3"
Expand Down Expand Up @@ -566,7 +573,7 @@
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jridgewell/trace-mapping" "^0.3.9"

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

"@jridgewell/[email protected]":
version "0.3.9"
resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz"
integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==
dependencies:
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.9":
version "0.3.22"
resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz"
Expand Down Expand Up @@ -3984,20 +3999,20 @@ min-indent@^1.0.0:
resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz"
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==

miniflare@3.20231030.1:
version "3.20231030.1"
resolved "https://registry.npmjs.org/miniflare/-/miniflare-3.20231030.1.tgz"
integrity sha512-Y+EkgV/aFg/3Y/xfFtImK36sLZGXvNS45avVEz0cUCA2pGpg4hGdPu1Udmz5b06SyeUEFVf/dEDMJwdRYVEgLw==
miniflare@3.20240524.1:
version "3.20240524.1"
resolved "https://registry.npmjs.org/miniflare/-/miniflare-3.20240524.1.tgz"
integrity sha512-5d3pRxvd5pT7lX1SsBH9+AjXuyHJnChSNOnYhubfi7pxMek4ZfULwhnUmNUp1R7b2xKuzqdFDZa0fsZuUoFxlw==
dependencies:
"@cspotcode/source-map-support" "0.8.1"
acorn "^8.8.0"
acorn-walk "^8.2.0"
capnp-ts "^0.7.0"
exit-hook "^2.2.1"
glob-to-regexp "^0.4.1"
source-map-support "0.5.21"
stoppable "^1.1.0"
undici "^5.22.1"
workerd "1.20231030.0"
undici "^5.28.2"
workerd "1.20240524.0"
ws "^8.11.0"
youch "^3.2.2"
zod "^3.20.6"
Expand Down Expand Up @@ -4878,7 +4893,7 @@ requires-port@^1.0.0:
resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz"
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==

resolve@^1.10.0, resolve@^1.10.1, resolve@^1.22.4:
resolve@^1.10.0, resolve@^1.10.1, resolve@^1.22.4, resolve@^1.22.8:
version "1.22.8"
resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz"
integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==
Expand Down Expand Up @@ -5189,7 +5204,7 @@ source-map-js@^1.0.2:
resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz"
integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==

source-map-support@0.5.21, source-map-support@~0.5.20:
source-map-support@~0.5.20:
version "0.5.21"
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz"
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
Expand Down Expand Up @@ -5741,7 +5756,7 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

undici@^5.22.1:
undici@^5.28.2:
version "5.28.2"
resolved "https://registry.npmjs.org/undici/-/undici-5.28.2.tgz"
integrity sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==
Expand Down Expand Up @@ -6010,38 +6025,39 @@ widest-line@^3.1.0:
dependencies:
string-width "^4.0.0"

workerd@1.20231030.0:
version "1.20231030.0"
resolved "https://registry.npmjs.org/workerd/-/workerd-1.20231030.0.tgz"
integrity sha512-+FSW+d31f8RrjHanFf/R9A+Z0csf3OtsvzdPmAKuwuZm/5HrBv83cvG9fFeTxl7/nI6irUUXIRF9xcj/NomQzQ==
workerd@1.20240524.0:
version "1.20240524.0"
resolved "https://registry.npmjs.org/workerd/-/workerd-1.20240524.0.tgz"
integrity sha512-LWLe5D8PVHBcqturmBbwgI71r7YPpIMYZoVEH6S4G35EqIJ55cb0n3FipoSyraoIfpcCxCFxX1K6WsRHbP3pFA==
optionalDependencies:
"@cloudflare/workerd-darwin-arm64" "1.20231030.0"
"@cloudflare/workerd-darwin-64" "1.20231030.0"
"@cloudflare/workerd-linux-arm64" "1.20231030.0"
"@cloudflare/workerd-linux-64" "1.20231030.0"
"@cloudflare/workerd-windows-64" "1.20231030.0"

[email protected]:
version "3.17.1"
resolved "https://registry.npmjs.org/wrangler/-/wrangler-3.17.1.tgz"
integrity sha512-Pr9+/tjFkthzG63uoVm1NtVvgokT6p92fy1UsOgrntHyTu0pZMC1VJzG0NC8Vhs+z/+yTT8AqVV6AiJb3w8ZOQ==
dependencies:
"@cloudflare/kv-asset-handler" "^0.2.0"
"@esbuild-plugins/node-globals-polyfill" "^0.2.3"
"@esbuild-plugins/node-modules-polyfill" "^0.2.2"
blake3-wasm "^2.1.5"
chokidar "^3.5.3"
esbuild "0.17.19"
"@cloudflare/workerd-darwin-arm64" "1.20240524.0"
"@cloudflare/workerd-darwin-64" "1.20240524.0"
"@cloudflare/workerd-linux-arm64" "1.20240524.0"
"@cloudflare/workerd-linux-64" "1.20240524.0"
"@cloudflare/workerd-windows-64" "1.20240524.0"

wrangler@^3.58.0:
version "3.58.0"
resolved "https://registry.npmjs.org/wrangler/-/wrangler-3.58.0.tgz"
integrity sha512-h9gWER7LXLnmHABDNP1p3aqXtchlvSBN8Dp22ZurnkxaLMZ3L3H1Ze1ftiFSs0VRWv0BUnz7AWIUqZmzuBY4Nw==
dependencies:
nanoid "^3.3.3"
path-to-regexp "^6.2.0"
resolve.exports "^2.0.2"
esbuild "0.17.19"
resolve "^1.22.8"
chokidar "^3.5.3"
optionalDependencies:
fsevents "~2.3.2"
dependencies:
miniflare "3.20240524.1"
selfsigned "^2.0.1"
source-map "0.6.1"
source-map-support "0.5.21"
blake3-wasm "^2.1.5"
xxhash-wasm "^1.0.1"
miniflare "3.20231030.1"
optionalDependencies:
fsevents "~2.3.2"
path-to-regexp "^6.2.0"
resolve.exports "^2.0.2"
"@cloudflare/kv-asset-handler" "0.3.2"
"@esbuild-plugins/node-globals-polyfill" "^0.2.3"
"@esbuild-plugins/node-modules-polyfill" "^0.2.2"

wrap-ansi@^3.0.1:
version "3.0.1"
Expand Down