test(handlebars): E2E validation that formatDate helper renders a date (#32960)#40817
test(handlebars): E2E validation that formatDate helper renders a date (#32960)#40817rusackas wants to merge 2 commits into
Conversation
#32960) Regression test for #32960: the `formatDate` Handlebars helper started rendering "i is not a function" (minified) / "moment is not a function" (dev) after 4.1.2. The helper (from just-handlebars-helpers) resolves moment lazily, which the bundled HandlebarsViewer no longer satisfies after switching to dayjs. This Playwright spec creates a Handlebars chart using `{{formatDate 'DD.MM.YYYY' ds}}` and asserts it renders a real formatted date instead of the helper error. It fails red on master, faithfully reproducing the bug, and turns green once the helper works again. Closes #32960 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Code Review Agent Run #430de0
Actionable Suggestions - 1
-
superset-frontend/playwright/tests/chart/handlebars-format-date.spec.ts - 1
- TypeScript any type violation · Line 42-42
Review Details
-
Files reviewed - 1 · Commit Range:
51555ab..51555ab- superset-frontend/playwright/tests/chart/handlebars-format-date.spec.ts
-
Files skipped - 0
-
Tools
- Eslint (Linter) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40817 +/- ##
==========================================
- Coverage 64.19% 64.18% -0.01%
==========================================
Files 2666 2666
Lines 143991 143991
Branches 33108 33108
==========================================
- Hits 92428 92427 -1
- Misses 49950 49951 +1
Partials 1613 1613
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review Agent Run #aeb634Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
This is a test-only PR opened as a TDD-style validation of issue #32960.
#32960 reports that the
formatDateHandlebars 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:
formatDateis provided by thejust-handlebars-helperslibrary, whose implementation resolves moment lazily (var moment = global.moment; if (!moment) moment = require('moment/min/moment-with-locales');). The bundledHandlebarsViewerswitched frommomenttodayjsand 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 (Noderequire('moment/...')resolves fine), which is why this is an E2E test.This PR adds one Playwright spec:
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 aDD.MM.YYYYdate 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
formatDateworks again; merging closes Helper formatDate stopped working in Handlebars charts since 4.1.2 update #32960 and locks in the guard.superset-frontend/plugins/plugin-chart-handlebars(e.g. register a moment-freeformatDate, or make moment resolvable for the helper).TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
🤖 Generated with Claude Code