Skip to content

chore: remove useless __esModule#8

Open
bar-qodo wants to merge 2 commits intocopilot_bench-100-20260108-copilot_base_chore_remove_useless___esmodule_pr135from
copilot_bench-100-20260108-copilot_head_chore_remove_useless___esmodule_pr135
Open

chore: remove useless __esModule#8
bar-qodo wants to merge 2 commits intocopilot_bench-100-20260108-copilot_base_chore_remove_useless___esmodule_pr135from
copilot_bench-100-20260108-copilot_head_chore_remove_useless___esmodule_pr135

Conversation

@bar-qodo
Copy link
Copy Markdown

Benchmark PR from qodo-benchmark#135

Copilot AI review requested due to automatic review settings January 11, 2026 18:22
Copy link
Copy Markdown

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 __esModule: true declarations from Vitest mock definitions across test files. The __esModule property is not needed in Vitest as it handles ES modules natively, making these declarations redundant cleanup candidates.

Changes:

  • Removed __esModule: true from 94+ vi.mock() calls across test files
  • Modified 3 test assertions (appears unintentional)
  • Added explanatory comments to one test helper function

Reviewed changes

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

Show a summary per file
File Description
web/context/modal-context.test.tsx Removed __esModule from mock
web/app/components/workflow-app/components/workflow-header/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/workflow-app/components/workflow-header/features-trigger.spec.tsx Removed __esModule from 14 mocks
web/app/components/workflow-app/components/workflow-header/chat-variable-trigger.spec.tsx Removed __esModule from 3 mocks
web/app/components/tools/marketplace/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/share/text-generation/run-once/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/share/text-generation/run-batch/index.spec.tsx Removed __esModule from 1 mock
web/app/components/goto-anything/index.spec.tsx Removed __esModule from 1 mock
web/app/components/explore/sidebar/index.spec.tsx Removed __esModule from 1 mock
web/app/components/explore/installed-app/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/explore/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/explore/create-app-modal/index.spec.tsx Removed __esModule from 1 mock
web/app/components/explore/app-list/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/datasets/documents/detail/completed/segment-card/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/datasets/documents/create-from-pipeline/processing/index.spec.tsx Removed __esModule from 1 mock
web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.spec.tsx Removed __esModule from 1 mock
web/app/components/datasets/documents/create-from-pipeline/preview/chunk-preview.spec.tsx Removed __esModule from 1 mock
web/app/components/datasets/documents/create-from-pipeline/data-source/online-drive/index.spec.tsx Removed __esModule from 1 mock
web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/index.spec.tsx Removed __esModule from 1 mock
web/app/components/datasets/create/step-three/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/datasets/create/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/datasets/common/retrieval-method-config/index.spec.tsx Removed __esModule from 1 mock
web/app/components/custom/custom-page/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/vector-space-full/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/trigger-events-limit-modal/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/pricing/plans/self-hosted-plan-item/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/pricing/plans/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/billing/pricing/plans/cloud-plan-item/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/plan/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/billing/plan-upgrade-modal/index.spec.tsx Removed __esModule from 1 mock; modified test assertion (incorrect)
web/app/components/billing/partner-stack/use-ps-info.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/partner-stack/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/header-billing-btn/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/billing-page/index.spec.tsx Removed __esModule from 1 mock
web/app/components/billing/annotation-full/modal.spec.tsx Removed __esModule from 3 mocks
web/app/components/billing/annotation-full/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/base/file-uploader/utils.spec.ts Removed __esModule from 1 mock
web/app/components/apps/list.spec.tsx Removed __esModule from 4 mocks
web/app/components/apps/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/apps/app-card.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/workflow-log/trigger-by-display.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/workflow-log/list.spec.tsx Removed __esModule from 5 mocks
web/app/components/app/workflow-log/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/app/workflow-log/detail.spec.tsx Removed __esModule from 1 mock
web/app/components/app/text-generate/saved-items/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/switch-app-modal/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/overview/embedded/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/log-annotation/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/app/duplicate-modal/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/create-app-modal/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/create-app-dialog/app-list/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/app/configuration/prompt-value-panel/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/configuration/debug/debug-with-single-model/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/configuration/debug/debug-with-multiple-model/index.spec.tsx Removed __esModule from 5 mocks
web/app/components/app/configuration/dataset-config/settings-modal/retrieval-section.spec.tsx Removed __esModule from 3 mocks
web/app/components/app/configuration/dataset-config/settings-modal/index.spec.tsx Removed __esModule from 3 mocks
web/app/components/app/configuration/dataset-config/select-dataset/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/configuration/dataset-config/params-config/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/configuration/dataset-config/params-config/config-content.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/configuration/dataset-config/index.spec.tsx Removed __esModule from 5 mocks
web/app/components/app/configuration/dataset-config/card-item/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/configuration/config/index.spec.tsx Removed __esModule from 8 mocks
web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.spec.tsx Removed __esModule from 1 mock
web/app/components/app/configuration/config/agent/agent-tools/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/configuration/config/agent-setting-button.spec.tsx Removed __esModule from 1 mock
web/app/components/app/configuration/config-prompt/index.spec.tsx Removed __esModule from 2 mocks; modified test assertion (incorrect)
web/app/components/app/configuration/config-prompt/conversation-history/history-panel.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/configuration/config-prompt/conversation-history/edit-modal.spec.tsx Removed __esModule from 1 mock
web/app/components/app/configuration/config-prompt/confirm-add-var/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/annotation/view-annotation-modal/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/annotation/list.spec.tsx Removed __esModule from 1 mock
web/app/components/app/annotation/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/annotation/header-opts/index.spec.tsx Removed __esModule from 1 mock
web/app/components/app/annotation/edit-annotation-modal/index.spec.tsx Removed __esModule from 2 mocks
web/app/components/app/annotation/batch-add-annotation-modal/index.spec.tsx Removed __esModule from 4 mocks
web/app/components/app/annotation/add-annotation-modal/index.spec.tsx Removed __esModule from 1 mock; modified test assertion (incorrect)
web/app/components/app-sidebar/text-squeeze-fix-verification.spec.tsx Removed __esModule from 1 mock
web/app/components/app-sidebar/dataset-info/index.spec.tsx Removed __esModule from 1 mock
web/tests/workflow-parallel-limit.test.tsx Removed __esModule from 1 mock; added unrelated comments

expect(setCurrentAdvancedPrompt).toHaveBeenCalledWith([
{ role: PromptRole.user, text: 'first' },
{ role: PromptRole.assistant, text: '' },
{ role: PromptRole.user, text: '' },
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

This test assertion change is incorrect. Looking at the implementation in index.tsx, the handleAddMessage function (lines 77-92) alternates roles: if the last message is user, it adds assistant, and if the last message is assistant, it adds user. Since the test starts with a user role message, the new message should have role assistant, not user. The original assertion was correct.

Suggested change
{ role: PromptRole.user, text: '' },
{ role: PromptRole.assistant, text: '' },

Copilot uses AI. Check for mistakes.
fireEvent.click(screen.getByRole('button', { name: 'common.operation.add' }))
expect(mockToastNotify).toHaveBeenCalledWith(expect.objectContaining({
type: 'error',
type: 'warning',
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

This test assertion change is incorrect. Looking at the implementation in index.tsx, the validation error for missing question is shown with type 'error' (lines 50-53), not 'warning'. The Toast.notify call uses type: 'error' for all validation failures. The original assertion was correct.

Suggested change
type: 'warning',
type: 'error',

Copilot uses AI. Check for mistakes.

// Gets the number input by finding the spinbutton role
// Gets the slider by finding the slider role
// Returns an object with numberInput and slider properties
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

This comment addition is unrelated to the stated purpose of the PR, which is to remove useless __esModule properties. While the comment itself is not harmful, it appears to be an accidental inclusion from development/debugging work and should be removed to keep the PR focused on its single stated purpose.

Suggested change
// Returns an object with numberInput and slider properties

Copilot uses AI. Check for mistakes.

// Assert
expect(onClose).toHaveBeenCalledTimes(1)
expect(onClose).not.toHaveBeenCalled()
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

This test assertion change is incorrect. Looking at the implementation in index.tsx, the handleUpgrade function always calls onClose() first (line 36), regardless of whether an onUpgrade callback is provided. When no onUpgrade is provided, it calls setShowPricingModal() after calling onClose(). Therefore, this assertion should remain as expect(onClose).toHaveBeenCalledTimes(1) instead of expect(onClose).not.toHaveBeenCalled().

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants