Skip to content

test(handlebars): E2E validation that formatDate helper renders a date (#32960)#40817

Open
rusackas wants to merge 2 commits into
masterfrom
tdd/issue-32960-handlebars-formatdate
Open

test(handlebars): E2E validation that formatDate helper renders a date (#32960)#40817
rusackas wants to merge 2 commits into
masterfrom
tdd/issue-32960-handlebars-formatdate

Conversation

@rusackas
Copy link
Copy Markdown
Member

@rusackas rusackas commented Jun 5, 2026

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

TESTING INSTRUCTIONS

cd superset-frontend
npx playwright test playwright/tests/chart/handlebars-format-date.spec.ts

ADDITIONAL INFORMATION

🤖 Generated with Claude Code

#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>
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 5, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 51555ab
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a236064d58abe0008dbc6b9
😎 Deploy Preview https://deploy-preview-40817--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #430de0

Actionable Suggestions - 1
  • superset-frontend/playwright/tests/chart/handlebars-format-date.spec.ts - 1
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

AI Code Review powered by Bito Logo

Comment thread superset-frontend/playwright/tests/chart/handlebars-format-date.spec.ts Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.18%. Comparing base (3d7021f) to head (eb2ba20).
⚠️ Report is 4 commits behind head on master.

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              
Flag Coverage Δ
javascript 67.86% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Jun 6, 2026

Code Review Agent Run #aeb634

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 51555ab..eb2ba20
    • 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

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helper formatDate stopped working in Handlebars charts since 4.1.2 update

2 participants