Skip to content

Commit 0c2b1b8

Browse files
committed
chore: fix test
1 parent 67828f0 commit 0c2b1b8

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

playground/deno/deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@std/assert": "jsr:@std/assert@1",
44
"@intlify/utils": "jsr:@intlify/utils@^0.14.1"
55
},
6-
"nodeModulesDir": true,
6+
"nodeModulesDir": "auto",
77
"tasks": {
88
"dev": "deno run --watch main.ts",
99
"test": "deno test --allow-read=$(which deno) --allow-run --allow-net ./deno.spec.ts"

playground/node/node.test.mjs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import assert from 'node:assert'
2-
import test from 'node:test'
3-
import { spawn } from 'node:child_process'
4-
import { fetch } from 'ofetch'
5-
import process from 'node:process'
1+
import assert from "node:assert";
2+
import test from "node:test";
3+
import { spawn } from "node:child_process";
4+
import { fetch } from "ofetch";
5+
import process from "node:process";
66

7-
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
7+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
88

9-
test('node integration test', async () => {
10-
const child = spawn('npx', ['--no-install', 'tsx', './index.ts'], {
9+
test("node integration test", async () => {
10+
const child = spawn("pnpx", ["tsx", "./index.ts"], {
1111
cwd: process.cwd(),
12-
stdio: 'inherit',
13-
})
14-
await sleep(2000)
12+
stdio: "inherit",
13+
});
14+
await sleep(3000);
1515

16-
const req = new Request('http://localhost:8123')
17-
req.headers.set('accept-language', 'en-US,en;q=0.9,ja;q=0.8')
18-
const res = await fetch(req)
19-
await sleep(1000)
16+
const req = new Request("http://localhost:8123");
17+
req.headers.set("accept-language", "en-US,en;q=0.9,ja;q=0.8");
18+
const res = await fetch(req);
19+
await sleep(1000);
2020

21-
console.log(child.pid)
21+
console.log(child.pid);
2222

2323
const cleanup = () => {
24-
process.kill(child.pid)
25-
}
24+
process.kill(child.pid);
25+
};
2626

27-
process.on('SIGINT', cleanup)
28-
process.on('SIGTERM', cleanup)
29-
process.on('SIGQUIT', cleanup)
27+
process.on("SIGINT", cleanup);
28+
process.on("SIGTERM", cleanup);
29+
process.on("SIGQUIT", cleanup);
3030

31-
assert.deepEqual('detect accpect-language: en-US,en,ja', await res.text())
32-
})
31+
assert.deepEqual("detect accpect-language: en-US,en,ja", await res.text());
32+
});

0 commit comments

Comments
 (0)