diff --git a/test/bundler/__snapshots__/bun-build-api.test.ts.snap b/test/bundler/__snapshots__/bun-build-api.test.ts.snap index ee8156b900..3f625ec089 100644 --- a/test/bundler/__snapshots__/bun-build-api.test.ts.snap +++ b/test/bundler/__snapshots__/bun-build-api.test.ts.snap @@ -58,486 +58,11 @@ NS.then(({ fn: fn2 }) => { " `; -exports[`Bun.build BuildArtifact properties: hash 1`] = `"r6c8x1cc"`; +exports[`Bun.build BuildArtifact properties: hash 1`] = `"d1c7nm6t"`; -exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"vanwb97w"`; +exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"rm7e36cf"`; -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"r6c8x1cc"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`; - -exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build Bun.write(BuildArtifact) 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build outdir + reading out blobs works 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build BuildArtifact properties: hash 1`] = `"r6c8x1cc"`; - -exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"vanwb97w"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"r6c8x1cc"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`; - -exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build Bun.write(BuildArtifact) 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build outdir + reading out blobs works 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`; - -exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build Bun.write(BuildArtifact) 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build outdir + reading out blobs works 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`; - -exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build Bun.write(BuildArtifact) 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build outdir + reading out blobs works 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`; - -exports[`Bun.build new Response(BuildArtifact) sets content type: response text 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build Bun.write(BuildArtifact) 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build outdir + reading out blobs works 1`] = ` -"var __defProp = Object.defineProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { - get: all[name], - enumerable: true, - configurable: true, - set: (newValue) => all[name] = () => newValue - }); -}; - -// test/bundler/fixtures/trivial/fn.js -var exports_fn = {}; -__export(exports_fn, { - fn: () => fn -}); -function fn(a) { - return a + 42; -} - -// test/bundler/fixtures/trivial/index.js -var NS = Promise.resolve().then(() => exports_fn); -NS.then(({ fn: fn2 }) => { - console.log(fn2(42)); -}); -" -`; - -exports[`Bun.build BuildArtifact properties: hash 1`] = `"5909xc4p"`; - -exports[`Bun.build BuildArtifact properties + entry.naming: hash 1`] = `"e1cnkf2m"`; - -exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"5909xc4p"`; +exports[`Bun.build BuildArtifact properties sourcemap: hash index.js 1`] = `"d1c7nm6t"`; exports[`Bun.build BuildArtifact properties sourcemap: hash index.js.map 1`] = `"00000000"`; diff --git a/test/bundler/bun-build-api.test.ts b/test/bundler/bun-build-api.test.ts index 8d59b54639..6106a823f6 100644 --- a/test/bundler/bun-build-api.test.ts +++ b/test/bundler/bun-build-api.test.ts @@ -24,11 +24,11 @@ describe("Bun.build", () => { entrypoints: [join(dir, "a.css")], experimentalCss: true, minify: true, - }) + }); expect(build.outputs).toHaveLength(1); expect(build.outputs[0].kind).toBe("entry-point"); - expect(await build.outputs[0].text()).toEqualIgnoringWhitespace('.hello{color:#00f}.hi{color:red}\n'); + expect(await build.outputs[0].text()).toEqualIgnoringWhitespace(".hello{color:#00f}.hi{color:red}\n"); }); test("experimentalCss = false works", async () => { @@ -51,12 +51,11 @@ describe("Bun.build", () => { entrypoints: [join(dir, "a.css")], outdir: join(dir, "out"), minify: true, - }) + }); - console.log(build.outputs); expect(build.outputs).toHaveLength(2); expect(build.outputs[0].kind).toBe("entry-point"); - expect(await build.outputs[0].text()).not.toEqualIgnoringWhitespace('.hello{color:#00f}.hi{color:red}\n'); + expect(await build.outputs[0].text()).not.toEqualIgnoringWhitespace(".hello{color:#00f}.hi{color:red}\n"); }); test("bytecode works", async () => {