Skip to content

Commit ac10bc3

Browse files
authored
chore: fix not e2e in local on v9 (#2027)
1 parent 963b95b commit ac10bc3

File tree

3 files changed

+69
-16
lines changed

3 files changed

+69
-16
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": "^20.11.21",
9090
"@types/rc": "^1.2.4",
91+
"@types/serve-handler": "^6.1.4",
9192
"@vitest/coverage-v8": "^1.3.0",
9293
"api-docs-gen": "^0.4.0",
9394
"benchmark": "^2.1.4",
@@ -122,7 +123,7 @@
122123
"rollup-plugin-node-globals": "^1.4.0",
123124
"rollup-plugin-typescript2": "^0.36.0",
124125
"secretlint": "^3.2.0",
125-
"serve-static": "^1.15.0",
126+
"serve-handler": "^6.1.6",
126127
"textlint": "^12.6.1",
127128
"textlint-filter-rule-comments": "^1.2.2",
128129
"textlint-rule-abbr-within-parentheses": "^1.0.2",

pnpm-lock.yaml

Lines changed: 59 additions & 12 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: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import { fileURLToPath } from 'node:url'
22
import { URL } from 'node:url'
33

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

87
const __dirname = fileURLToPath(new URL('..', import.meta.url))
98

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

0 commit comments

Comments
 (0)