import { describe } from "bun:test"; import { isWindows } from "harness"; import { itBundled } from "./expectBundled"; describe("bundler", () => { itBundled("npm/ReactSSR", { todo: isWindows, // TODO(@paperclover) install: ["react@18.3.1", "react-dom@18.3.1"], files: { "/entry.tsx": /* tsx */ ` import React from "react"; import { renderToReadableStream } from "react-dom/server"; const headers = { headers: { "Content-Type": "text/html", }, }; const App = () => (
This is an example.
); const port = 0; using server = Bun.serve({ port, async fetch(req) { return new Response(await renderToReadableStream(This is an example.
", }, }); itBundled("npm/LodashES", { install: ["lodash-es"], files: { "/entry.ts": /* tsx */ ` import { isEqual, isBuffer } from "lodash-es"; // https://github.com/oven-sh/bun/issues/3206 if(!isEqual({a: 1}, {a: 1})) throw "error 1"; if(isEqual({a: 1}, {a: 2})) throw "error 2"; // Uncomment when https://github.com/lodash/lodash/issues/5660 is fixed // It prevents isBuffer from working at all since it evaluates to 'stubFalse' // if(!isBuffer(Buffer.from("hello"))) throw "error 3"; // if(isBuffer("hello")) throw "error 4"; // if(isBuffer({})) throw "error 5"; // if(isBuffer(new Uint8Array([1]))) throw "error 6"; // if(isBuffer(new ArrayBuffer(1))) throw "error 7"; console.log('pass') `, }, run: { stdout: "pass", }, }); });