Skip to content

chore: remove useless __esModule#30366

Merged
lyzno1 merged 1 commit intomainfrom
12-30-remove-esModule
Dec 30, 2025
Merged

chore: remove useless __esModule#30366
lyzno1 merged 1 commit intomainfrom
12-30-remove-esModule

Conversation

@hyoban
Copy link
Member

@hyoban hyoban commented Dec 30, 2025

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
Copilot AI review requested due to automatic review settings December 30, 2025 06:42
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 30, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @hyoban, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a targeted cleanup of test files by removing redundant __esModule: true declarations within vi.mock calls. This is a technical refinement that contributes to a cleaner codebase and more robust testing practices, ensuring that module mocks behave as expected without unnecessary boilerplate.

Highlights

  • Test File Cleanup: The pull request systematically removes the __esModule: true property from vi.mock calls across numerous test files within the web directory. This change streamlines mock definitions in Vitest/Jest tests.
  • Improved Module Mocking: By removing this often unnecessary property, the PR aims to enhance consistency and potentially prevent compatibility issues with module mocking in the testing environment.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist 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

This pull request removes the now-redundant __esModule: true property from vi.mock calls across numerous test files. This is a good cleanup that modernizes the test suite's mocking strategy, as modern versions of Vitest handle ES module mocking automatically. The changes are consistent and correct across all modified files. I have reviewed the changes and they look good to me.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the unnecessary __esModule: true property from Vitest mock return objects across test files. The __esModule property was historically used for Babel/TypeScript interop but is not required in modern Vitest, which handles ES module mocking natively.

Key changes:

  • Removed __esModule: true from approximately 90+ mock definitions across test files
  • No functional changes to test behavior or logic

Reviewed changes

Copilot reviewed 79 out of 79 changed files in this pull request and generated no comments.

Show a summary per file
File Description
web/context/modal-context.test.tsx Removed __esModule from trigger events modal mock
web/app/components/workflow-app/components/workflow-header/index.spec.tsx Removed __esModule from app store, workflow header, and workflow service mocks
web/app/components/workflow-app/components/workflow-header/features-trigger.spec.tsx Removed __esModule from 11 different mocks including workflow hooks, stores, and service mocks
web/app/components/workflow-app/components/workflow-header/chat-variable-trigger.spec.tsx Removed __esModule from workflow hooks and chat variable button mocks
web/app/components/tools/marketplace/index.spec.tsx Removed __esModule from marketplace list and utility function mocks
web/app/components/share/text-generation/run-once/index.spec.tsx Removed __esModule from breakpoints, code editor, and image uploader mocks
web/app/components/share/text-generation/run-batch/index.spec.tsx Removed __esModule from breakpoints mock
web/app/components/goto-anything/index.spec.tsx Removed __esModule from actions mock
web/app/components/explore/sidebar/index.spec.tsx Removed __esModule from breakpoints mock
web/app/components/explore/installed-app/index.spec.tsx Removed __esModule from text generation and chat component mocks
web/app/components/explore/index.spec.tsx Removed __esModule from breakpoints and document title hooks
web/app/components/explore/create-app-modal/index.spec.tsx Removed __esModule from emoji-mart data mock
web/app/components/explore/app-list/index.spec.tsx Removed __esModule from create app modal and DSL confirm modal mocks
web/app/components/datasets/documents/detail/completed/segment-card/index.spec.tsx Removed __esModule from status item, image list, and markdown component mocks
web/app/components/datasets/documents/create-from-pipeline/processing/index.spec.tsx Removed __esModule from embedding process mock
web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.spec.tsx Removed __esModule from Next.js image mock
web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.spec.tsx Removed __esModule from document picker mock
web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.spec.tsx Removed __esModule from toast component mock
web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.spec.tsx Removed __esModule from toast component mock
web/app/components/datasets/create/step-three/index.spec.tsx Removed __esModule from embedding process and breakpoints mocks
web/app/components/datasets/create/index.spec.tsx Removed __esModule from step-one, step-two, and step-three component mocks
web/app/components/datasets/common/retrieval-method-config/index.spec.tsx Removed __esModule from retrieval param config mock
web/app/components/custom/custom-page/index.spec.tsx Removed __esModule from custom web app brand mock
web/app/components/billing/vector-space-full/index.spec.tsx Removed __esModule from upgrade button mock
web/app/components/billing/trigger-events-limit-modal/index.spec.tsx Removed __esModule from plan upgrade modal mock
web/app/components/billing/pricing/plans/self-hosted-plan-item/index.spec.tsx Removed __esModule from toast component mock
web/app/components/billing/pricing/plans/index.spec.tsx Removed __esModule from cloud and self-hosted plan item mocks
web/app/components/billing/pricing/plans/cloud-plan-item/index.spec.tsx Removed __esModule from toast component mock
web/app/components/billing/plan/index.spec.tsx Removed __esModule from verify state modal and upgrade button mocks
web/app/components/billing/plan-upgrade-modal/index.spec.tsx Removed __esModule from base modal mock
web/app/components/billing/partner-stack/use-ps-info.spec.tsx Removed __esModule from js-cookie mock
web/app/components/billing/partner-stack/index.spec.tsx Removed __esModule from partner stack info hook mock
web/app/components/billing/header-billing-btn/index.spec.tsx Removed __esModule from upgrade button mock
web/app/components/billing/billing-page/index.spec.tsx Removed __esModule from plan component mock
web/app/components/billing/annotation-full/modal.spec.tsx Removed __esModule from usage, upgrade button, and modal mocks
web/app/components/billing/annotation-full/index.spec.tsx Removed __esModule from usage and upgrade button mocks
web/app/components/base/file-uploader/utils.spec.ts Removed __esModule from mime library mock
web/app/components/apps/list.spec.tsx Removed __esModule from query state hook, tag filter, app card, empty state, and footer mocks
web/app/components/apps/index.spec.tsx Removed __esModule from document title hook and list component mocks
web/app/components/apps/app-card.spec.tsx Removed __esModule from tooltip and tag selector mocks
web/app/components/app/workflow-log/trigger-by-display.spec.tsx Removed __esModule from theme hook and block icon mocks
web/app/components/app/workflow-log/list.spec.tsx Removed __esModule from timestamp, breakpoints, workflow run, block icon, and theme hook mocks
web/app/components/app/workflow-log/index.spec.tsx Removed __esModule from Next.js link, workflow run, and theme hook mocks
web/app/components/app/workflow-log/detail.spec.tsx Removed __esModule from workflow run mock
web/app/components/app/text-generate/saved-items/index.spec.tsx Removed __esModule from copy-to-clipboard mock
web/app/components/app/switch-app-modal/index.spec.tsx Removed __esModule from apps full dialog mock
web/app/components/app/overview/embedded/index.spec.tsx Removed __esModule from CSS module and copy-to-clipboard mocks
web/app/components/app/log-annotation/index.spec.tsx Removed __esModule from annotation, log, and workflow log component mocks
web/app/components/app/duplicate-modal/index.spec.tsx Removed __esModule from apps full dialog mock
web/app/components/app/create-app-modal/index.spec.tsx Removed __esModule from theme hook mock
web/app/components/app/create-app-dialog/app-list/index.spec.tsx Removed __esModule from type selector, app card, and create app modal mocks
web/app/components/app/configuration/prompt-value-panel/index.spec.tsx Removed __esModule from feature bar mock
web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx Removed __esModule from timestamp hook mock
web/app/components/app/configuration/debug/debug-with-multiple-model/index.spec.tsx Removed __esModule from 6 mocks including context hooks, stores, and components
web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.spec.tsx Removed __esModule from model provider hooks and selector mocks
web/app/components/app/configuration/dataset-config/settings-modal/index.spec.tsx Removed __esModule from step-two, common service, and model provider mocks
web/app/components/app/configuration/dataset-config/select-dataset/index.spec.tsx Removed __esModule from i18next config mock
web/app/components/app/configuration/dataset-config/params-config/index.spec.tsx Removed __esModule from model selector and parameter modal mocks
web/app/components/app/configuration/dataset-config/params-config/config-content.spec.tsx Removed __esModule from model selector and parameter modal mocks
web/app/components/app/configuration/dataset-config/index.spec.tsx Removed __esModule from 5 component mocks including card item, params config, context var, metadata filter, and config context
web/app/components/app/configuration/dataset-config/card-item/index.spec.tsx Removed __esModule from settings modal and breakpoints mocks
web/app/components/app/configuration/config/index.spec.tsx Removed __esModule from 8 mocks including debug hooks and configuration components
web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.spec.tsx Removed __esModule from form component mock
web/app/components/app/configuration/config/agent/agent-tools/index.spec.tsx Removed __esModule from tool picker and setting built-in tool mocks
web/app/components/app/configuration/config/agent-setting-button.spec.tsx Removed __esModule from agent setting mock
web/app/components/app/configuration/config-prompt/index.spec.tsx Removed __esModule from simple and advanced prompt input mocks
web/app/components/app/configuration/config-prompt/conversation-history/history-panel.spec.tsx Removed __esModule from operation button and feature panel mocks
web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.spec.tsx Removed __esModule from modal mock
web/app/components/app/configuration/config-prompt/confirm-add-var/index.spec.tsx Removed __esModule from var highlight mock
web/app/components/app/annotation/view-annotation-modal/index.spec.tsx Removed __esModule from timestamp hook and edit item mocks
web/app/components/app/annotation/list.spec.tsx Removed __esModule from timestamp hook mock
web/app/components/app/annotation/index.spec.tsx Removed __esModule from toast component mock
web/app/components/app/annotation/header-opts/index.spec.tsx Removed __esModule from annotation full component mock
web/app/components/app/annotation/edit-annotation-modal/index.spec.tsx Removed __esModule from timestamp hook and annotation full mocks
web/app/components/app/annotation/batch-add-annotation-modal/index.spec.tsx Removed __esModule from toast, CSV downloader/uploader, and annotation full mocks
web/app/components/app/annotation/add-annotation-modal/index.spec.tsx Removed __esModule from toast component mock
web/app/components/app-sidebar/text-squeeze-fix-verification.spec.tsx Removed __esModule from classnames utility mock
web/app/components/app-sidebar/dataset-info/index.spec.tsx Removed __esModule from rename modal mock
web/tests/workflow-parallel-limit.test.tsx Removed __esModule from iteration config hook mock

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

3 participants