diff options
author | 2021-09-30 22:37:46 -0700 | |
---|---|---|
committer | 2021-09-30 22:37:46 -0700 | |
commit | d47419f4711c562e4b4b1642406cb29e326201c2 (patch) | |
tree | 78fdd39e536d13da5a4f35ff60138a1c2d0a8b33 | |
parent | 367f9c96740c4c4a9f717eb80b50e40bfc0e88af (diff) | |
download | bun-d47419f4711c562e4b4b1642406cb29e326201c2.tar.gz bun-d47419f4711c562e4b4b1642406cb29e326201c2.tar.zst bun-d47419f4711c562e4b4b1642406cb29e326201c2.zip |
Snapshots
9 files changed, 63 insertions, 36 deletions
diff --git a/integration/scripts/browser.js b/integration/scripts/browser.js index 05473c249..f3ddefea9 100644 --- a/integration/scripts/browser.js +++ b/integration/scripts/browser.js @@ -119,6 +119,7 @@ async function main() { "/code-simplification-neql-define.js", "/spread_with_key.tsx", "/styledcomponents-output.js", + "/void-shouldnt-delete-call-expressions.js", ]; tests.reverse(); diff --git a/integration/snapshots/multiple-imports.debug.js b/integration/snapshots/multiple-imports.debug.js index b96b270cf..1bc6eb747 100644 --- a/integration/snapshots/multiple-imports.debug.js +++ b/integration/snapshots/multiple-imports.debug.js @@ -4,7 +4,7 @@ __require as require import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); -var jsx = require(JSX).jsxDEV, fileName = "multiple-imports.js", JSXFrag = require(JSXClassic).Fragment; +var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; var { default: React} = require($bbcd215f); var { default: React2} = require($bbcd215f); @@ -12,10 +12,7 @@ const bacon = React; const bacon2 = jsx(JSXFrag, { children: ["hello"] -}, undefined, true, { - fileName, - lineNumber: 92 -}, this); +}, undefined, true, undefined, this); export function test() { console.assert(bacon === React); console.assert(bacon === React2); diff --git a/integration/snapshots/multiple-imports.hmr.debug.js b/integration/snapshots/multiple-imports.hmr.debug.js index f2a331498..4b05677e0 100644 --- a/integration/snapshots/multiple-imports.hmr.debug.js +++ b/integration/snapshots/multiple-imports.hmr.debug.js @@ -10,7 +10,7 @@ __HMRModule as HMR import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); -var jsx = require(JSX).jsxDEV, fileName = "multiple-imports.js", JSXFrag = require(JSXClassic).Fragment; +var jsx = require(JSX).jsxDEV, JSXFrag = require(JSXClassic).Fragment; var { default: React} = require($bbcd215f); var { default: React2} = require($bbcd215f); @@ -21,10 +21,7 @@ var hmr = new HMR(2165509932, "multiple-imports.js"), exports = hmr.exports; const bacon = React; const bacon2 = jsx(JSXFrag, { children: ["hello"] - }, undefined, true, { - fileName, - lineNumber: 92 - }, this); + }, undefined, true, undefined, this); function test() { console.assert(bacon === React); console.assert(bacon === React2); diff --git a/integration/snapshots/spread_with_key.debug.tsx b/integration/snapshots/spread_with_key.debug.tsx index 1490c9b1a..052e3f4ba 100644 --- a/integration/snapshots/spread_with_key.debug.tsx +++ b/integration/snapshots/spread_with_key.debug.tsx @@ -4,7 +4,7 @@ __require as require import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); -var jsx = require(JSX).jsxDEV, fileName = "spread_with_key.tsx", jsxEl = require(JSXClassic).createElement; +var jsx = require(JSX).jsxDEV, jsxEl = require(JSXClassic).createElement; var { default: React} = require($bbcd215f); export function SpreadWithTheKey({ @@ -23,9 +23,6 @@ export function SpreadWithTheKey({ export function test() { console.assert(React.isValidElement(jsx(SpreadWithTheKey, { className: "foo" - }, undefined, true, { - fileName, - lineNumber: 375 - }, this))); + }, undefined, true, undefined, this))); return testDone(import.meta.url); } diff --git a/integration/snapshots/spread_with_key.hmr.debug.tsx b/integration/snapshots/spread_with_key.hmr.debug.tsx index d9029c380..dd66edcc3 100644 --- a/integration/snapshots/spread_with_key.hmr.debug.tsx +++ b/integration/snapshots/spread_with_key.hmr.debug.tsx @@ -10,7 +10,7 @@ __HMRModule as HMR import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js"; var JSXClassic = require($bbcd215f); -var jsx = require(JSX).jsxDEV, fileName = "spread_with_key.tsx", jsxEl = require(JSXClassic).createElement; +var jsx = require(JSX).jsxDEV, jsxEl = require(JSXClassic).createElement; var { default: React} = require($bbcd215f); Bun.activate(true); @@ -31,10 +31,7 @@ var hmr = new HMR(2717584935, "spread_with_key.tsx"), exports = hmr.exports; function test() { console.assert(React.isValidElement(jsx(SpreadWithTheKey, { className: "foo" - }, undefined, true, { - fileName, - lineNumber: 375 - }, this))); + }, undefined, true, undefined, this))); return testDone(import.meta.url); } hmr.exportAll({ diff --git a/integration/snapshots/styledcomponents-output.debug.js b/integration/snapshots/styledcomponents-output.debug.js index 913a52d16..df45ce11e 100644 --- a/integration/snapshots/styledcomponents-output.debug.js +++ b/integration/snapshots/styledcomponents-output.debug.js @@ -2,7 +2,7 @@ import { __require as require } from "http://localhost:8080/__runtime.js"; import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; -var jsx = require(JSX).jsxDEV, fileName = "styledcomponents-output.js"; +var jsx = require(JSX).jsxDEV; import * as $d4051a2e from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; var { default: styled} = require($d4051a2e); @@ -44,16 +44,14 @@ export function test() { document.body.appendChild(reactEl); ReactDOM.render(jsx(ErrorScreenRoot, { id: "error-el", - children: ["This is an error! Look for the string"] - }, undefined, true, { - fileName, - lineNumber: 805 - }, this), reactEl); + children: ["The react child should have this text"] + }, undefined, true, undefined, this), reactEl); const style = document.querySelector("style[data-styled]"); console.assert(style, "style tag should exist"); - console.assert(!style.textContent.includes("晜"), "style tag should not contain invalid unicode codepoints"); - console.assert(document.querySelector("#error-el").textContent === "This is an error! Look for the string"); + console.assert(style.textContent.split("").every((a) => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints"); + console.assert(document.querySelector("#error-el").textContent === "The react child should have this text"); ReactDOM.unmountComponentAtNode(reactEl); reactEl.remove(); + style.remove(); testDone(import.meta.url); } diff --git a/integration/snapshots/styledcomponents-output.hmr.debug.js b/integration/snapshots/styledcomponents-output.hmr.debug.js index cddc9e5f6..25b291547 100644 --- a/integration/snapshots/styledcomponents-output.hmr.debug.js +++ b/integration/snapshots/styledcomponents-output.hmr.debug.js @@ -8,7 +8,7 @@ import { __HMRModule as HMR } from "http://localhost:8080/__runtime.js"; import * as JSX from "http://localhost:8080/node_modules/react/jsx-dev-runtime.js"; -var jsx = require(JSX).jsxDEV, fileName = "styledcomponents-output.js"; +var jsx = require(JSX).jsxDEV; import * as $d4051a2e from "http://localhost:8080/node_modules/styled-components/dist/styled-components.browser.esm.js"; var { default: styled} = require($d4051a2e); @@ -53,17 +53,15 @@ var hmr = new HMR(1290604342, "styledcomponents-output.js"), exports = hmr.expor document.body.appendChild(reactEl); ReactDOM.render(jsx(ErrorScreenRoot, { id: "error-el", - children: ["This is an error! Look for the string"] - }, undefined, true, { - fileName, - lineNumber: 805 - }, this), reactEl); + children: ["The react child should have this text"] + }, undefined, true, undefined, this), reactEl); const style = document.querySelector("style[data-styled]"); console.assert(style, "style tag should exist"); - console.assert(!style.textContent.includes("晜"), "style tag should not contain invalid unicode codepoints"); - console.assert(document.querySelector("#error-el").textContent === "This is an error! Look for the string"); + console.assert(style.textContent.split("").every((a) => a.codePointAt(0) < 128), "style tag should not contain invalid unicode codepoints"); + console.assert(document.querySelector("#error-el").textContent === "The react child should have this text"); ReactDOM.unmountComponentAtNode(reactEl); reactEl.remove(); + style.remove(); testDone(import.meta.url); } hmr.exportAll({ diff --git a/integration/snapshots/void-shouldnt-delete-call-expressions.debug.js b/integration/snapshots/void-shouldnt-delete-call-expressions.debug.js new file mode 100644 index 000000000..3e088c5a7 --- /dev/null +++ b/integration/snapshots/void-shouldnt-delete-call-expressions.debug.js @@ -0,0 +1,10 @@ +var was_called = false; +function thisShouldBeCalled() { + was_called = true; +} +thisShouldBeCalled(); +export function test() { + if (!was_called) + throw new Error("Expected thisShouldBeCalled to be called"); + return testDone(import.meta.url); +} diff --git a/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js new file mode 100644 index 000000000..ebc46c9ba --- /dev/null +++ b/integration/snapshots/void-shouldnt-delete-call-expressions.hmr.debug.js @@ -0,0 +1,32 @@ +import { +__HMRModule as HMR +} from "http://localhost:8080/__runtime.js"; +import { +__HMRClient as Bun +} from "http://localhost:8080/__runtime.js"; +Bun.activate(true); + +var hmr = new HMR(635901064, "void-shouldnt-delete-call-expressions.js"), exports = hmr.exports; +(hmr._load = function() { + var was_called = false; + function thisShouldBeCalled() { + was_called = true; + } + thisShouldBeCalled(); + function test() { + if (!was_called) + throw new Error("Expected thisShouldBeCalled to be called"); + return testDone(import.meta.url); + } + hmr.exportAll({ + test: () => test + }); +})(); +var $$hmr_test = hmr.exports.test; +hmr._update = function(exports) { + $$hmr_test = exports.test; +}; + +export { + $$hmr_test as test +}; |