Skip to content

test: align unit tests with Vitest 5 default mock clearing - #4090

Merged
ala-n merged 2 commits into
mainfrom
test/vitest-5-clear-mocks
Nov 6, 2026
Merged

ala-n merged 2 commits into
mainfrom
test/vitest-5-clear-mocks

Conversation

@dshovchko

Copy link
Copy Markdown
Collaborator

Summary

Removes the temporary clearMocks: false configuration workaround and refactors unit tests that relied on shared mock call history across test cases to ensure full compatibility with Vitest 5 default behavior (clearMocks: true).

Changes

  • Configuration:
    • Removed explicit clearMocks: false from packages/esl/vitest.config.ts.
  • Unit Tests:
    • animate.mixin.test.ts: moved element initialization and microtask wait into beforeEach so that DOM attachment and mixin discovery occur freshly for each test.
    • esl-trigger.actions.test.ts: corrected event simulation for hover in mode: 'hide' to dispatch mouseenter (which triggers hide in hide-only mode) and added assertion for ignored mouseleave.
    • decorate.test.ts: consolidated interdependent @decorate lifecycle checks into self-contained test cases.
    • target.test.ts: migrated shared suite state to beforeEach hooks and added explicit Mock<EventListener> / Mock<EventListenerObject['handleEvent']> typing to satisfy DOM event listener signatures.

@dshovchko
dshovchko requested review from a team, NastaLeo, abarmina, ala-n and fshovchko October 9, 2026 11:02
@dshovchko dshovchko self-assigned this Oct 9, 2026
@qltysh

qltysh Bot commented Oct 9, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@ala-n ala-n added the needs review The PR is waiting for review label Oct 19, 2026
@ala-n
ala-n merged commit 58350b9 into main Nov 6, 2026
8 checks passed
@ala-n
ala-n deleted the test/vitest-5-clear-mocks branch November 6, 2026 17:32
@ci-github-action-bot ci-github-action-bot Bot locked and limited conversation to collaborators Nov 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs review The PR is waiting for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants