Skip to content

Commit 8d029fa

Browse files
committed
chore: fix not work e2e in local
1 parent bd85a57 commit 8d029fa

File tree

3 files changed

+76
-17
lines changed

3 files changed

+76
-17
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"@types/minimist": "^1.2.5",
8989
"@types/node": "^22.5.3",
9090
"@types/rc": "^1.2.4",
91+
"@types/serve-handler": "^6.1.4",
9192
"@vitest/coverage-v8": "^2.0.0",
9293
"api-docs-gen": "^0.4.0",
9394
"benchmark": "^2.1.4",
@@ -121,7 +122,7 @@
121122
"rollup-plugin-node-globals": "^1.4.0",
122123
"rollup-plugin-typescript2": "^0.36.0",
123124
"secretlint": "^3.2.0",
124-
"serve-static": "^1.15.0",
125+
"serve-handler": "^6.1.6",
125126
"textlint": "^12.6.1",
126127
"textlint-filter-rule-comments": "^1.2.2",
127128
"textlint-rule-abbr-within-parentheses": "^1.0.2",

pnpm-lock.yaml

Lines changed: 65 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/vitest.globalSetup.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import { fileURLToPath } from 'node:url'
2-
import { URL } from 'node:url'
1+
import { fileURLToPath, URL } from 'node:url'
32

4-
// @ts-ignore
5-
import serveStatic from 'serve-static'
63
import { listen } from 'listhen'
4+
import handler from 'serve-handler'
75

86
const __dirname = fileURLToPath(new URL('..', import.meta.url))
97

108
export async function setup() {
11-
const listener = await listen(serveStatic(__dirname), { port: 8080 })
9+
const listener = await listen(
10+
(req, res) => {
11+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
12+
handler(req, res, { public: __dirname })
13+
},
14+
{ port: 8080 }
15+
)
1216
return async () => {
1317
await listener.close()
1418
}

0 commit comments

Comments
 (0)