rusackas opened a new pull request, #40817:
URL: https://github.com/apache/superset/pull/40817

   ### SUMMARY
   
   This is a **test-only PR** opened as a TDD-style validation of issue #32960.
   
   #32960 reports that the `formatDate` Handlebars helper stopped working after 
the 4.1.2 update — a template using `{{formatDate 'DD.MM.YYYY' t}}` renders 
**"i is not a function"** instead of the formatted date.
   
   Root cause: `formatDate` is provided by the `just-handlebars-helpers` 
library, whose implementation resolves moment lazily (`var moment = 
global.moment; if (!moment) moment = 
require('moment/min/moment-with-locales');`). The bundled `HandlebarsViewer` 
switched from `moment` to `dayjs` and no longer makes moment resolvable in the 
production bundle, so the lazy lookup yields a non-callable value — surfaced 
minified as *"i is not a function"* (and as *"moment is not a function"* in a 
dev build). Because the failure is a bundling/minification artifact, it does 
**not** reproduce in a Jest unit test (Node `require('moment/...')` resolves 
fine), which is why this is an E2E test.
   
   This PR adds one Playwright spec:
   
   1. **`Handlebars formatDate helper renders a formatted date (#32960)`** — 
creates a Handlebars chart whose template uses `{{formatDate 'DD.MM.YYYY' 
ds}}`, opens it in Explore, and asserts the chart renders a `DD.MM.YYYY` date 
and does **not** render a "... is not a function" error. Verified to fail red 
on current master (renders "moment is not a function").
   
   ### How to interpret CI
   
   - **CI green** → `formatDate` works again; merging closes #32960 and locks 
in the guard.
   - **CI red** → the bug is still live. Fix belongs in 
`superset-frontend/plugins/plugin-chart-handlebars` (e.g. register a 
moment-free `formatDate`, or make moment resolvable for the helper).
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npx playwright test playwright/tests/chart/handlebars-format-date.spec.ts
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: closes #32960
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to