From d5dee809338c551a8ff2301eabdfc9e83609eb91 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Thu, 27 Apr 2023 16:25:41 -0400 Subject: [PATCH] Failing test for fbt issue Specifically, the fbt plugin would error on a `null` loc as it [relies on it in one of its utils](https://github.com/facebook/fbt/blob/6a23a5374a757a49654d8304a3efea8eb9548eea/packages/babel-plugin-fbt/src/getNamespacedArgs.js#L82-L84), implying a missing `loc` somewhere in our pipeline after codegen --- .../compiler/error.lambda-with-fbt.expect.md | 45 +++++++++++++++++++ .../compiler/error.lambda-with-fbt.js | 30 +++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 compiler/forget/src/__tests__/fixtures/compiler/error.lambda-with-fbt.expect.md create mode 100644 compiler/forget/src/__tests__/fixtures/compiler/error.lambda-with-fbt.js diff --git a/compiler/forget/src/__tests__/fixtures/compiler/error.lambda-with-fbt.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/error.lambda-with-fbt.expect.md new file mode 100644 index 0000000000..7e2e5e0b32 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/error.lambda-with-fbt.expect.md @@ -0,0 +1,45 @@ + +## Input + +```javascript +import { fbt } from "fbt"; + +function Component() { + const buttonLabel = () => { + if (!someCondition) { + return {"Purchase as a gift"}; + } else if ( + !iconOnly && + showPrice && + item?.current_gift_offer?.price?.formatted != null + ) { + return ( + + {"Gift | "} + + {item?.current_gift_offer?.price?.formatted} + + + ); + } else if (!iconOnly && !showPrice) { + return {"Gift"}; + } + }; + + return ( + +