From f7f1b604443c030afe29d1059b90f72c69afe081 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Wed, 9 Nov 2022 15:40:40 -0800 Subject: Add bun-types, add typechecking, add `child_process` types (#1475) * Add bun-types to packages * Improve typing * Fix types in tests * Fix dts tests * Run formatter * Fix all type errors * Add strict mode, fix type errors * Add ffi changes * Move workflows to root * Add workflows * Remove labeler * Add child_process types * Fix synthetic defaults issue * Remove docs * Move scripts * Run prettier * Include examples in typechecking * captureStackTrace types * moved captureStackTrace types to globals * Address reviews Co-authored-by: Colin McDonnell Co-authored-by: Dylan Conway --- test/bun.js/fetch.test.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test/bun.js/fetch.test.js') diff --git a/test/bun.js/fetch.test.js b/test/bun.js/fetch.test.js index 603cdfb3c..ebcdcbc8b 100644 --- a/test/bun.js/fetch.test.js +++ b/test/bun.js/fetch.test.js @@ -5,7 +5,7 @@ import { gc } from "./gc"; const exampleFixture = fs.readFileSync( import.meta.path.substring(0, import.meta.path.lastIndexOf("/")) + "/fetch.js.txt", - "utf8" + "utf8", ); describe("fetch", () => { @@ -74,7 +74,7 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { var response = blobbyConstructor(JSON.stringify(jsonObject)); if (withGC) gc(); expect(JSON.stringify(await response.json())).toBe( - JSON.stringify(jsonObject) + JSON.stringify(jsonObject), ); if (withGC) gc(); }); @@ -84,11 +84,11 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { } arrayBuffer -> json${withGC ? " (with gc) " : ""}`, async () => { if (withGC) gc(); var response = blobbyConstructor( - new TextEncoder().encode(JSON.stringify(jsonObject)) + new TextEncoder().encode(JSON.stringify(jsonObject)), ); if (withGC) gc(); expect(JSON.stringify(await response.json())).toBe( - JSON.stringify(jsonObject) + JSON.stringify(jsonObject), ); if (withGC) gc(); }); @@ -108,7 +108,7 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { } arrayBuffer -> text${withGC ? " (with gc) " : ""}`, async () => { if (withGC) gc(); var response = blobbyConstructor( - new TextEncoder().encode(JSON.stringify(jsonObject)) + new TextEncoder().encode(JSON.stringify(jsonObject)), ); if (withGC) gc(); expect(await response.text()).toBe(JSON.stringify(jsonObject)); @@ -144,7 +144,7 @@ function testBlobInterface(blobbyConstructor, hasBlobFn) { if (withGC) gc(); var response = blobbyConstructor( - new TextEncoder().encode(JSON.stringify(jsonObject)) + new TextEncoder().encode(JSON.stringify(jsonObject)), ); if (withGC) gc(); @@ -219,13 +219,13 @@ describe("Blob", () => { [ new Blob([ new TextEncoder().encode( - "πŸ˜€ πŸ˜ƒ πŸ˜„ 😁 πŸ˜† πŸ˜… πŸ˜‚ 🀣 πŸ₯² ☺️ 😊 πŸ˜‡ πŸ™‚ πŸ™ƒ πŸ˜‰ 😌 😍 πŸ₯° 😘 πŸ˜— πŸ˜™ 😚 πŸ˜‹ πŸ˜› 😝 😜 πŸ€ͺ 🀨 🧐 πŸ€“ 😎 πŸ₯Έ 🀩 πŸ₯³" + "πŸ˜€ πŸ˜ƒ πŸ˜„ 😁 πŸ˜† πŸ˜… πŸ˜‚ 🀣 πŸ₯² ☺️ 😊 πŸ˜‡ πŸ™‚ πŸ™ƒ πŸ˜‰ 😌 😍 πŸ₯° 😘 πŸ˜— πŸ˜™ 😚 πŸ˜‹ πŸ˜› 😝 😜 πŸ€ͺ 🀨 🧐 πŸ€“ 😎 πŸ₯Έ 🀩 πŸ₯³", ), ]), ], [ new TextEncoder().encode( - "πŸ˜€ πŸ˜ƒ πŸ˜„ 😁 πŸ˜† πŸ˜… πŸ˜‚ 🀣 πŸ₯² ☺️ 😊 πŸ˜‡ πŸ™‚ πŸ™ƒ πŸ˜‰ 😌 😍 πŸ₯° 😘 πŸ˜— πŸ˜™ 😚 πŸ˜‹ πŸ˜› 😝 😜 πŸ€ͺ 🀨 🧐 πŸ€“ 😎 πŸ₯Έ 🀩 πŸ₯³" + "πŸ˜€ πŸ˜ƒ πŸ˜„ 😁 πŸ˜† πŸ˜… πŸ˜‚ 🀣 πŸ₯² ☺️ 😊 πŸ˜‡ πŸ™‚ πŸ™ƒ πŸ˜‰ 😌 😍 πŸ₯° 😘 πŸ˜— πŸ˜™ 😚 πŸ˜‹ πŸ˜› 😝 😜 πŸ€ͺ 🀨 🧐 πŸ€“ 😎 πŸ₯Έ 🀩 πŸ₯³", ), ], ]; @@ -253,7 +253,7 @@ describe("Blob", () => { .split("") .map((a) => a.charCodeAt(0))}, received: ${res .split("") - .map((a) => a.charCodeAt(0))}` + .map((a) => a.charCodeAt(0))}`, ); } @@ -274,7 +274,7 @@ describe("Blob", () => { expect( await combined .slice(str.indexOf(part), str.indexOf(part) + part.length) - .text() + .text(), ).toBe(part); if (withGC) gc(); } @@ -284,7 +284,7 @@ describe("Blob", () => { expect( await combined .slice(str.indexOf(part), str.indexOf(part) + part.length) - .text() + .text(), ).toBe(part); if (withGC) gc(); } @@ -358,7 +358,7 @@ describe("Response", () => { let response = Response.json("hello"); expect(response.type).toBe("basic"); expect(response.headers.get("content-type")).toBe( - "application/json;charset=utf-8" + "application/json;charset=utf-8", ); expect(response.status).toBe(200); }); @@ -366,7 +366,7 @@ describe("Response", () => { let response = Response.json("hello", 407); expect(response.type).toBe("basic"); expect(response.headers.get("content-type")).toBe( - "application/json;charset=utf-8" + "application/json;charset=utf-8", ); expect(response.status).toBe(407); }); @@ -485,7 +485,7 @@ describe("Request", () => { testBlobInterface( (data) => new Request("https://hello.com", { body: data }), - true + true, ); }); -- cgit v1.2.3