diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1523a10..8eeb714c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,9 +77,9 @@ jobs: - uses: denoland/setup-deno@v1 with: deno-version: v1.x - - run: env NAME=Deno deno test --coverage=coverage/raw/deno-runtime --allow-read --allow-env --allow-write --allow-net -c runtime_tests/deno/deno.json runtime_tests/deno - - run: deno test -c runtime_tests/deno-jsx/deno.precompile.json --coverage=coverage/raw/deno-precompile-jsx runtime_tests/deno-jsx - - run: deno test -c runtime_tests/deno-jsx/deno.react-jsx.json --coverage=coverage/raw/deno-react-jsx runtime_tests/deno-jsx + - run: env NAME=Deno deno test --coverage=coverage/raw/deno-runtime --allow-read --allow-env --allow-write --allow-net -c runtime-tests/deno/deno.json runtime-tests/deno + - run: deno test -c runtime-tests/deno-jsx/deno.precompile.json --coverage=coverage/raw/deno-precompile-jsx runtime-tests/deno-jsx + - run: deno test -c runtime-tests/deno-jsx/deno.react-jsx.json --coverage=coverage/raw/deno-react-jsx runtime-tests/deno-jsx - uses: actions/upload-artifact@v4 with: name: coverage-deno diff --git a/package.json b/package.json index a253fd0e..cc7bf942 100644 --- a/package.json +++ b/package.json @@ -12,18 +12,18 @@ "scripts": { "test": "tsc --noEmit && vitest --run && vitest -c .vitest.config/jsx-runtime-default.ts --run && vitest -c .vitest.config/jsx-runtime-dom.ts --run", "test:watch": "vitest --watch", - "test:deno": "deno test --allow-read --allow-env --allow-write --allow-net -c runtime_tests/deno/deno.json runtime_tests/deno && deno test --no-lock -c runtime_tests/deno-jsx/deno.precompile.json runtime_tests/deno-jsx && deno test --no-lock -c runtime_tests/deno-jsx/deno.react-jsx.json runtime_tests/deno-jsx", - "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: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:deno": "deno test --allow-read --allow-env --allow-write --allow-net -c runtime-tests/deno/deno.json runtime-tests/deno && deno test --no-lock -c runtime-tests/deno-jsx/deno.precompile.json runtime-tests/deno-jsx && deno test --no-lock -c runtime-tests/deno-jsx/deno.react-jsx.json runtime-tests/deno-jsx", + "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: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:workerd && bun test:lambda && bun test:lambda-edge", - "lint": "eslint src runtime_tests", - "lint:fix": "eslint src runtime_tests --fix", - "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"", - "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime_tests/**/*.{js,ts,tsx}\"", + "lint": "eslint src runtime-tests", + "lint:fix": "eslint src runtime-tests --fix", + "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\"", + "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\"", "copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json ", "build": "bun run --shell bun remove-dist && bun ./build.ts && bun run copy:package.cjs.json", "postbuild": "publint", @@ -647,4 +647,4 @@ "engines": { "node": ">=16.9.0" } -} +} \ No newline at end of file diff --git a/runtime_tests/bun/.static/plain.txt b/runtime-tests/bun/.static/plain.txt similarity index 100% rename from runtime_tests/bun/.static/plain.txt rename to runtime-tests/bun/.static/plain.txt diff --git a/runtime_tests/bun/favicon.ico b/runtime-tests/bun/favicon.ico similarity index 100% rename from runtime_tests/bun/favicon.ico rename to runtime-tests/bun/favicon.ico diff --git a/runtime_tests/bun/index.test.tsx b/runtime-tests/bun/index.test.tsx similarity index 98% rename from runtime_tests/bun/index.test.tsx rename to runtime-tests/bun/index.test.tsx index a9d4bddb..8aaed909 100644 --- a/runtime_tests/bun/index.test.tsx +++ b/runtime-tests/bun/index.test.tsx @@ -83,10 +83,10 @@ describe('Basic Auth Middleware', () => { describe('Serve Static Middleware', () => { const app = new Hono() const onNotFound = vi.fn(() => {}) - app.all('/favicon.ico', serveStatic({ path: './runtime_tests/bun/favicon.ico' })) + app.all('/favicon.ico', serveStatic({ path: './runtime-tests/bun/favicon.ico' })) app.all( '/favicon-notfound.ico', - serveStatic({ path: './runtime_tests/bun/favicon-notfound.ico', onNotFound }) + serveStatic({ path: './runtime-tests/bun/favicon-notfound.ico', onNotFound }) ) app.use('/favicon-notfound.ico', async (c, next) => { await next() @@ -95,14 +95,14 @@ describe('Serve Static Middleware', () => { app.get( '/static/*', serveStatic({ - root: './runtime_tests/bun/', + root: './runtime-tests/bun/', onNotFound, }) ) app.get( '/dot-static/*', serveStatic({ - root: './runtime_tests/bun/', + root: './runtime-tests/bun/', rewriteRequestPath: (path) => path.replace(/^\/dot-static/, './.static'), }) ) @@ -121,7 +121,7 @@ describe('Serve Static Middleware', () => { expect(res.status).toBe(404) expect(res.headers.get('X-Custom')).toBe('Bun') expect(onNotFound).toHaveBeenCalledWith( - './runtime_tests/bun/favicon-notfound.ico', + './runtime-tests/bun/favicon-notfound.ico', expect.anything() ) }) diff --git a/runtime_tests/bun/static/download b/runtime-tests/bun/static/download similarity index 100% rename from runtime_tests/bun/static/download rename to runtime-tests/bun/static/download diff --git a/runtime_tests/bun/static/hello.world/index.html b/runtime-tests/bun/static/hello.world/index.html similarity index 100% rename from runtime_tests/bun/static/hello.world/index.html rename to runtime-tests/bun/static/hello.world/index.html diff --git a/runtime_tests/bun/static/helloworld/index.html b/runtime-tests/bun/static/helloworld/index.html similarity index 100% rename from runtime_tests/bun/static/helloworld/index.html rename to runtime-tests/bun/static/helloworld/index.html diff --git a/runtime_tests/bun/static/plain.txt b/runtime-tests/bun/static/plain.txt similarity index 100% rename from runtime_tests/bun/static/plain.txt rename to runtime-tests/bun/static/plain.txt diff --git a/runtime_tests/bun/vitest.config.ts b/runtime-tests/bun/vitest.config.ts similarity index 83% rename from runtime_tests/bun/vitest.config.ts rename to runtime-tests/bun/vitest.config.ts index 6b1cae41..df1122b6 100644 --- a/runtime_tests/bun/vitest.config.ts +++ b/runtime-tests/bun/vitest.config.ts @@ -5,7 +5,7 @@ import config from '../../vitest.config' export default defineConfig({ test: { globals: true, - include: ['**/runtime_tests/bun/**/*.+(ts|tsx|js)'], + include: ['**/runtime-tests/bun/**/*.+(ts|tsx|js)'], coverage: { ...config.test?.coverage, reportsDirectory: './coverage/raw/runtime-bun', diff --git a/runtime_tests/deno-jsx/deno.precompile.json b/runtime-tests/deno-jsx/deno.precompile.json similarity index 100% rename from runtime_tests/deno-jsx/deno.precompile.json rename to runtime-tests/deno-jsx/deno.precompile.json diff --git a/runtime_tests/deno-jsx/deno.react-jsx.json b/runtime-tests/deno-jsx/deno.react-jsx.json similarity index 100% rename from runtime_tests/deno-jsx/deno.react-jsx.json rename to runtime-tests/deno-jsx/deno.react-jsx.json diff --git a/runtime_tests/deno-jsx/jsx.test.tsx b/runtime-tests/deno-jsx/jsx.test.tsx similarity index 100% rename from runtime_tests/deno-jsx/jsx.test.tsx rename to runtime-tests/deno-jsx/jsx.test.tsx diff --git a/runtime_tests/deno/.static/plain.txt b/runtime-tests/deno/.static/plain.txt similarity index 100% rename from runtime_tests/deno/.static/plain.txt rename to runtime-tests/deno/.static/plain.txt diff --git a/runtime_tests/deno/.vscode/settings.json b/runtime-tests/deno/.vscode/settings.json similarity index 100% rename from runtime_tests/deno/.vscode/settings.json rename to runtime-tests/deno/.vscode/settings.json diff --git a/runtime_tests/deno/deno.json b/runtime-tests/deno/deno.json similarity index 100% rename from runtime_tests/deno/deno.json rename to runtime-tests/deno/deno.json diff --git a/runtime_tests/deno/deno.lock b/runtime-tests/deno/deno.lock similarity index 100% rename from runtime_tests/deno/deno.lock rename to runtime-tests/deno/deno.lock diff --git a/runtime_tests/deno/favicon.ico b/runtime-tests/deno/favicon.ico similarity index 100% rename from runtime_tests/deno/favicon.ico rename to runtime-tests/deno/favicon.ico diff --git a/runtime_tests/deno/hono.test.ts b/runtime-tests/deno/hono.test.ts similarity index 100% rename from runtime_tests/deno/hono.test.ts rename to runtime-tests/deno/hono.test.ts diff --git a/runtime_tests/deno/middleware.test.tsx b/runtime-tests/deno/middleware.test.tsx similarity index 96% rename from runtime_tests/deno/middleware.test.tsx rename to runtime-tests/deno/middleware.test.tsx index ad992fe9..ed55dc80 100644 --- a/runtime_tests/deno/middleware.test.tsx +++ b/runtime-tests/deno/middleware.test.tsx @@ -68,10 +68,10 @@ Deno.test('JSX middleware', async () => { Deno.test('Serve Static middleware', async () => { const app = new Hono() const onNotFound = spy(() => {}) - app.all('/favicon.ico', serveStatic({ path: './runtime_tests/deno/favicon.ico' })) + app.all('/favicon.ico', serveStatic({ path: './runtime-tests/deno/favicon.ico' })) app.all( '/favicon-notfound.ico', - serveStatic({ path: './runtime_tests/deno/favicon-notfound.ico', onNotFound }) + serveStatic({ path: './runtime-tests/deno/favicon-notfound.ico', onNotFound }) ) app.use('/favicon-notfound.ico', async (c, next) => { await next() @@ -81,7 +81,7 @@ Deno.test('Serve Static middleware', async () => { app.get( '/static/*', serveStatic({ - root: './runtime_tests/deno', + root: './runtime-tests/deno', onNotFound, }) ) @@ -89,7 +89,7 @@ Deno.test('Serve Static middleware', async () => { app.get( '/dot-static/*', serveStatic({ - root: './runtime_tests/deno', + root: './runtime-tests/deno', rewriteRequestPath: (path) => path.replace(/^\/dot-static/, './.static'), }) ) diff --git a/runtime_tests/deno/ssg.test.tsx b/runtime-tests/deno/ssg.test.tsx similarity index 100% rename from runtime_tests/deno/ssg.test.tsx rename to runtime-tests/deno/ssg.test.tsx diff --git a/runtime_tests/deno/static/download b/runtime-tests/deno/static/download similarity index 100% rename from runtime_tests/deno/static/download rename to runtime-tests/deno/static/download diff --git a/runtime_tests/deno/static/hello.world/index.html b/runtime-tests/deno/static/hello.world/index.html similarity index 100% rename from runtime_tests/deno/static/hello.world/index.html rename to runtime-tests/deno/static/hello.world/index.html diff --git a/runtime_tests/deno/static/helloworld/index.html b/runtime-tests/deno/static/helloworld/index.html similarity index 100% rename from runtime_tests/deno/static/helloworld/index.html rename to runtime-tests/deno/static/helloworld/index.html diff --git a/runtime_tests/deno/static/plain.txt b/runtime-tests/deno/static/plain.txt similarity index 100% rename from runtime_tests/deno/static/plain.txt rename to runtime-tests/deno/static/plain.txt diff --git a/runtime_tests/deno/stream.test.ts b/runtime-tests/deno/stream.test.ts similarity index 100% rename from runtime_tests/deno/stream.test.ts rename to runtime-tests/deno/stream.test.ts diff --git a/runtime_tests/fastly/index.test.ts b/runtime-tests/fastly/index.test.ts similarity index 100% rename from runtime_tests/fastly/index.test.ts rename to runtime-tests/fastly/index.test.ts diff --git a/runtime_tests/fastly/vitest.config.ts b/runtime-tests/fastly/vitest.config.ts similarity index 76% rename from runtime_tests/fastly/vitest.config.ts rename to runtime-tests/fastly/vitest.config.ts index c0480b13..d01a1a00 100644 --- a/runtime_tests/fastly/vitest.config.ts +++ b/runtime-tests/fastly/vitest.config.ts @@ -7,8 +7,8 @@ export default defineConfig({ plugins: [fastlyCompute()], test: { globals: true, - include: ['**/runtime_tests/fastly/**/(*.)+(test).+(ts|tsx)'], - exclude: ['**/runtime_tests/fastly/vitest.config.ts'], + include: ['**/runtime-tests/fastly/**/(*.)+(test).+(ts|tsx)'], + exclude: ['**/runtime-tests/fastly/vitest.config.ts'], coverage: { ...config.test?.coverage, reportsDirectory: './coverage/raw/runtime-fastly', diff --git a/runtime_tests/lambda-edge/index.test.ts b/runtime-tests/lambda-edge/index.test.ts similarity index 100% rename from runtime_tests/lambda-edge/index.test.ts rename to runtime-tests/lambda-edge/index.test.ts diff --git a/runtime_tests/lambda-edge/vitest.config.ts b/runtime-tests/lambda-edge/vitest.config.ts similarity index 72% rename from runtime_tests/lambda-edge/vitest.config.ts rename to runtime-tests/lambda-edge/vitest.config.ts index 105ac950..5fd8bc9f 100644 --- a/runtime_tests/lambda-edge/vitest.config.ts +++ b/runtime-tests/lambda-edge/vitest.config.ts @@ -8,8 +8,8 @@ export default defineConfig({ NAME: 'Node', }, globals: true, - include: ['**/runtime_tests/lambda-edge/**/*.+(ts|tsx|js)'], - exclude: ['**/runtime_tests/lambda-edge/vitest.config.ts'], + include: ['**/runtime-tests/lambda-edge/**/*.+(ts|tsx|js)'], + exclude: ['**/runtime-tests/lambda-edge/vitest.config.ts'], coverage: { ...config.test?.coverage, reportsDirectory: './coverage/raw/runtime-lambda-edge', diff --git a/runtime_tests/lambda/index.test.ts b/runtime-tests/lambda/index.test.ts similarity index 100% rename from runtime_tests/lambda/index.test.ts rename to runtime-tests/lambda/index.test.ts diff --git a/runtime_tests/lambda/mock.ts b/runtime-tests/lambda/mock.ts similarity index 100% rename from runtime_tests/lambda/mock.ts rename to runtime-tests/lambda/mock.ts diff --git a/runtime_tests/lambda/stream-mock.ts b/runtime-tests/lambda/stream-mock.ts similarity index 100% rename from runtime_tests/lambda/stream-mock.ts rename to runtime-tests/lambda/stream-mock.ts diff --git a/runtime_tests/lambda/stream.test.ts b/runtime-tests/lambda/stream.test.ts similarity index 100% rename from runtime_tests/lambda/stream.test.ts rename to runtime-tests/lambda/stream.test.ts diff --git a/runtime_tests/lambda/vitest.config.ts b/runtime-tests/lambda/vitest.config.ts similarity index 64% rename from runtime_tests/lambda/vitest.config.ts rename to runtime-tests/lambda/vitest.config.ts index 01caae52..8cee5a8e 100644 --- a/runtime_tests/lambda/vitest.config.ts +++ b/runtime-tests/lambda/vitest.config.ts @@ -8,11 +8,11 @@ export default defineConfig({ NAME: 'Node', }, globals: true, - include: ['**/runtime_tests/lambda/**/*.+(ts|tsx|js)'], + include: ['**/runtime-tests/lambda/**/*.+(ts|tsx|js)'], exclude: [ - '**/runtime_tests/lambda/vitest.config.ts', - '**/runtime_tests/lambda/mock.ts', - '**/runtime_tests/lambda/stream-mock.ts', + '**/runtime-tests/lambda/vitest.config.ts', + '**/runtime-tests/lambda/mock.ts', + '**/runtime-tests/lambda/stream-mock.ts', ], coverage: { ...config.test?.coverage, diff --git a/runtime_tests/node/index.test.ts b/runtime-tests/node/index.test.ts similarity index 100% rename from runtime_tests/node/index.test.ts rename to runtime-tests/node/index.test.ts diff --git a/runtime_tests/node/vitest.config.ts b/runtime-tests/node/vitest.config.ts similarity index 74% rename from runtime_tests/node/vitest.config.ts rename to runtime-tests/node/vitest.config.ts index 5387c11f..4cb6deed 100644 --- a/runtime_tests/node/vitest.config.ts +++ b/runtime-tests/node/vitest.config.ts @@ -8,8 +8,8 @@ export default defineConfig({ NAME: 'Node', }, globals: true, - include: ['**/runtime_tests/node/**/*.+(ts|tsx|js)'], - exclude: ['**/runtime_tests/node/vitest.config.ts'], + include: ['**/runtime-tests/node/**/*.+(ts|tsx|js)'], + exclude: ['**/runtime-tests/node/vitest.config.ts'], coverage: { ...config.test?.coverage, reportsDirectory: './coverage/raw/runtime-node', diff --git a/runtime_tests/tsconfig.json b/runtime-tests/tsconfig.json similarity index 100% rename from runtime_tests/tsconfig.json rename to runtime-tests/tsconfig.json diff --git a/runtime_tests/workerd/index.test.ts b/runtime-tests/workerd/index.test.ts similarity index 93% rename from runtime_tests/workerd/index.test.ts rename to runtime-tests/workerd/index.test.ts index 8a28daa9..2173ce6a 100644 --- a/runtime_tests/workerd/index.test.ts +++ b/runtime-tests/workerd/index.test.ts @@ -6,7 +6,7 @@ describe('workerd', () => { let worker: UnstableDevWorker beforeAll(async () => { - worker = await unstable_dev('./runtime_tests/workerd/index.ts', { + worker = await unstable_dev('./runtime-tests/workerd/index.ts', { vars: { NAME: 'Hono', }, @@ -35,7 +35,7 @@ describe('workerd with WebSocket', () => { // worker.fetch does not support WebSocket: // https://github.com/cloudflare/workers-sdk/issues/4573#issuecomment-1850420973 it('Should handle the WebSocket connection correctly', async () => { - const worker = await unstable_dev('./runtime_tests/workerd/index.ts', { + const worker = await unstable_dev('./runtime-tests/workerd/index.ts', { experimental: { disableExperimentalWarning: true }, }) const ws = new WebSocket(`ws://${worker.address}:${worker.port}/ws`) diff --git a/runtime_tests/workerd/index.ts b/runtime-tests/workerd/index.ts similarity index 100% rename from runtime_tests/workerd/index.ts rename to runtime-tests/workerd/index.ts diff --git a/runtime_tests/workerd/vitest.config.ts b/runtime-tests/workerd/vitest.config.ts similarity index 71% rename from runtime_tests/workerd/vitest.config.ts rename to runtime-tests/workerd/vitest.config.ts index 43410a1b..c82861be 100644 --- a/runtime_tests/workerd/vitest.config.ts +++ b/runtime-tests/workerd/vitest.config.ts @@ -5,8 +5,8 @@ import config from '../../vitest.config' export default defineConfig({ test: { globals: true, - include: ['**/runtime_tests/workerd/**/(*.)+(test).+(ts|tsx)'], - exclude: ['**/runtime_tests/workerd/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-workerd', diff --git a/vitest.config.ts b/vitest.config.ts index 26ce5de6..8c968fde 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -19,7 +19,7 @@ export default defineConfig({ exclude: [ ...(configDefaults.coverage.exclude ?? []), 'benchmarks', - 'runtime_tests', + 'runtime-tests', 'build.ts', 'src/test-utils',