Skip to content

test(formatjs): Add regression test for issue #532 string concatenation in defaultMessage#594

Merged
kdy1 merged 1 commit into
mainfrom
claude/issue-532-20260321-0027
Mar 21, 2026
Merged

test(formatjs): Add regression test for issue #532 string concatenation in defaultMessage#594
kdy1 merged 1 commit into
mainfrom
claude/issue-532-20260321-0027

Conversation

@kdy1
Copy link
Copy Markdown
Member

@kdy1 kdy1 commented Mar 21, 2026

Fixes #532

Adds an explicit regression test reproducing the exact code from issue #532, verifying that string concatenation like 'Hello ' + 'world' in defaultMessage is properly evaluated rather than producing an empty array.

Generated with Claude Code

…on in defaultMessage

Adds an explicit regression test that reproduces the exact code from
issue #532, verifying that string concatenation like 'Hello ' + 'world'
in defaultMessage is properly evaluated rather than producing an empty array.

Co-authored-by: Donny/강동윤 <kdy1@users.noreply.github.com>
@kdy1 kdy1 enabled auto-merge (squash) March 21, 2026 00:37
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 21, 2026

⚠️ No Changeset found

Latest commit: a45eda0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@claude
Copy link
Copy Markdown

claude Bot commented Mar 21, 2026

PR Review

This is a clean, focused regression test for issue #532. Here's my feedback:

What's good

  • The test directly reproduces the exact code pattern from the issue (single-quoted strings, no description field)
  • The comment linking to the issue (// Regression test for .../issues/532) is helpful for future reference
  • The negative assertion expect(output).not.toMatch(/defaultMessage: \[\]/) clearly documents the specific failure mode (empty array instead of concatenated string)
  • Follows the existing test file conventions

Observations

Distinction from existing test is intentional and important. There's already a similar test ("should handle string concatenation in defaultMessage") using double-quoted strings with a description field. The new test uses single-quoted strings without a description field — this appears to be the precise combination that triggered the bug. The distinction is valid.

Minor nit: The test name "should handle string concatenation in defaultMessage (issue #532)" is a bit redundant with the comment above it. Consider either dropping the (issue #532) suffix from the name (since the comment already links the issue) or dropping the comment. Not a blocker.

No changeset needed — test-only changes don't require version bumps, so the changeset-bot warning is expected and fine.

Summary

The regression test is correct, minimal, and appropriately targeted. No blocking issues.

@kdy1 kdy1 merged commit 27bcf2e into main Mar 21, 2026
10 of 11 checks passed
@kdy1 kdy1 deleted the claude/issue-532-20260321-0027 branch March 21, 2026 00:40
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a45eda0042

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});
`;

const output = await transformCode(input);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exercise AST mode in the regression test

I checked packages/formatjs/transform/src/lib.rs:893-905, and the defaultMessage: [] symptom only comes from the options.ast branch; with the default transformCode(input) call here, the plugin always prints a string literal instead. As written, this test can still pass while issue #532 remains broken for ast: true, so it doesn't actually cover the empty-array regression described in the comment/commit message.

Useful? React with 👍 / 👎.

kdy1 added a commit that referenced this pull request Mar 21, 2026
## Summary
- Addressed `chatgpt-codex-connector[bot]` review follow-ups across
merged PRs: #585, #591, #592, #593, #594, #595, #597, #598, #599.
- Applied the fixes as 9 separate commits (one commit per original PR)
in a single follow-up branch.

## What Changed
- #585 / #592 (`loadable-components`)
- Fixed source-less default-import matching to honor the configured
local name.
- Updated `ssr: false` detection to respect final object-literal
override order.
  - Added/updated fixtures for both behaviors.
- #591 / #594 (`formatjs`)
- Added JSX member-expression message component support (e.g.
`ReactIntl.FormattedMessage`).
  - Updated #532 regression coverage to validate the `ast: true` path.
- #593 / #595 (`graphql-codegen-client-preset`)
  - Extended `namingConvention` parsing to accept string/object forms.
- Preserved names for `keep`/unknown conventions instead of forcing
PascalCase.
- Fixed Windows absolute `filename` path handling in WASM runtime path
resolution.
  - Added unit coverage for the new config/path behaviors.
- #597 / #599 (`emotion`)
- Ensured tagged-template labels are terminated before sourcemap
comments.
- Added css-prop rewrite support for namespace imports
(`emotionReact.css`).
  - Attached PURE comments to the generated call site span.
  - Updated emotion fixtures accordingly.
- #598 (docs)
- Corrected capability descriptions in `packages/jest/README.tmpl.md`
and `packages/swc-sdk/README.tmpl.md`.

## Validation
- `cargo test -p swc_plugin_loadable_components --test fixture --
--ignored`
- `cargo test -p swc_plugin_graphql_codegen_client_preset`
- `cargo test -p swc_emotion --test fixture -- --ignored`
- `pnpm -C /Users/kdy1/.codex/worktrees/17e6/plugins/packages/formatjs
test`

All passed (formatjs has an existing non-blocking Vitest warning about
an un-awaited rejects assertion).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

FormatJS Plugin doesn't support string concatenation

2 participants