aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-04 07:03:46 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-05-04 07:03:46 -0700
commit66e8d7346f4e2d0baffdcc23ab56c4ed3d77037a (patch)
treeb4527a6c950250b07e8e4a81c3dae0896e00877c /integration/bunjs-only-snippets
parentd29dcf36803bd645e7a225de2a73d93aba00a951 (diff)
downloadbun-66e8d7346f4e2d0baffdcc23ab56c4ed3d77037a.tar.gz
bun-66e8d7346f4e2d0baffdcc23ab56c4ed3d77037a.tar.zst
bun-66e8d7346f4e2d0baffdcc23ab56c4ed3d77037a.zip
make our http test run more
Diffstat (limited to 'integration/bunjs-only-snippets')
-rw-r--r--integration/bunjs-only-snippets/serve.test.ts39
1 files changed, 21 insertions, 18 deletions
diff --git a/integration/bunjs-only-snippets/serve.test.ts b/integration/bunjs-only-snippets/serve.test.ts
index d5b1b581e..323caf1f8 100644
--- a/integration/bunjs-only-snippets/serve.test.ts
+++ b/integration/bunjs-only-snippets/serve.test.ts
@@ -32,23 +32,26 @@ it("should work for a file", async () => {
server.stop();
});
-// var count = 200;
-// it(`should work for a file ${count} times`, async () => {
-// const fixture = resolve(import.meta.dir, "./fetch.js.txt");
-// const textToExpect = readFileSync(fixture, "utf-8");
-// var ran = 0;
-// const server = serve({
-// port: port++,
-// async fetch(req) {
-// console.log(`Ran ${ran++}`);
-// return new Response(file(fixture));
-// },
-// });
+var count = 200;
+it(`should work for a file ${count} times`, async () => {
+ const fixture = resolve(import.meta.dir, "./fetch.js.txt");
+ const textToExpect = readFileSync(fixture, "utf-8");
+ var ran = 0;
+ const server = serve({
+ port: port++,
+ async fetch(req) {
+ return new Response(file(fixture));
+ },
+ });
-// for (let i = 0; i < count; i++) {
-// const response = await fetch(`http://localhost:${server.port}`);
-// expect(await response.text()).toBe(textToExpect);
-// }
+ // this gets stuck if run about 200 times awaiting all the promises
+ // when the promises are run altogether, instead of one at a time
+ // it's hard to say if this only happens here due to some weird stuff with the test runner
+ // or if it's "real" issue
+ for (let i = 0; i < count; i++) {
+ const response = await fetch(`http://localhost:${server.port}`);
+ expect(await response.text()).toBe(textToExpect);
+ }
-// server.stop();
-// });
+ server.stop();
+});