aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/transpiler.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'integration/bunjs-only-snippets/transpiler.test.js')
-rw-r--r--integration/bunjs-only-snippets/transpiler.test.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/transpiler.test.js b/integration/bunjs-only-snippets/transpiler.test.js
index 61024e400..dd0ffdc8f 100644
--- a/integration/bunjs-only-snippets/transpiler.test.js
+++ b/integration/bunjs-only-snippets/transpiler.test.js
@@ -132,6 +132,9 @@ describe("Bun.Transpiler", () => {
},
platform: "bun",
macro: {
+ inline: {
+ whatDidIPass: `${import.meta.dir}/inline.macro.js`,
+ },
react: {
bacon: `${import.meta.dir}/macro-check.js`,
},
@@ -618,6 +621,35 @@ describe("Bun.Transpiler", () => {
expectBunPrinted_("export const foo = 1 * 2", "export const foo = 2");
});
+ it("pass objects to macros", () => {
+ var object = {
+ helloooooooo: {
+ message: [12345],
+ },
+ };
+
+ const output = bunTranspiler.transformSync(
+ `
+ import {whatDidIPass} from 'inline';
+
+ export function foo() {
+ return whatDidIPass();
+ }
+ `,
+ object
+ );
+ expect(output).toBe(`export function foo() {
+ return {
+ helloooooooo: {
+ message: [
+ 12345
+ ]
+ }
+ };
+}
+`);
+ });
+
it("rewrite string to length", () => {
expectPrinted_(
`export const foo = "a".length + "b".length;`,