Skip to content

head#71

Open
ChitkulLakshya wants to merge 2 commits intomainfrom
head
Open

head#71
ChitkulLakshya wants to merge 2 commits intomainfrom
head

Conversation

@ChitkulLakshya
Copy link
Copy Markdown
Collaborator

  • fixed the parese error of security
  • fixed some packages versions
  • fixed the blockage
  • fix: resolve vi.mock hoisting and spyon namespace issues in electron tests

Description

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing functionality)
  • Documentation update
  • Refactor (no functional changes)
  • CI/CD changes

Related Issues

Screenshots (if applicable)

Testing

  • Tested on Windows
  • Tested on macOS
  • Tested on Linux
  • Unit tests added/updated
  • Manual testing completed

Checklist

  • Code follows project coding standards
  • Self-review of code performed
  • Comments added for complex logic
  • Documentation updated (if applicable)
  • All tests pass locally
  • No new warnings or errors introduced

Copilot AI review requested due to automatic review settings April 1, 2026 10:18
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zync Ready Ready Preview, Comment Apr 1, 2026 10:24am

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 updates Electron unit tests to address Vitest mocking pitfalls (mock hoisting / spying on Node builtins) that can cause runtime errors in the test suite.

Changes:

  • Adjust node:fs import style in the window-state unit test to support vi.spyOn usage.
  • Refactor the electron module mock in the tray unit test to avoid Vitest hoisting/TDZ issues and update the related assertion.
  • Refactor the electron module mock setup in the menu unit test (currently introduces a syntax/shape error).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
electron/tests/unit/main/window-state.test.ts Switches fs import style used by spies in window-state tests.
electron/tests/unit/main/tray.test.ts Makes Tray mock hoist-safe by defining it inside the vi.mock factory; updates assertion accordingly.
electron/tests/unit/main/menu.test.ts Introduces a shared mockApp, but the vi.mock factory object is currently malformed (parse-breaking).

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

Comment on lines +58 to +63
vi.mock('electron', () => {
const MockTrayConstructorInline = vi.fn((icon: unknown) => {
createdTrayIcon = icon;
mockTrayInstance = createMockTray(icon);
return mockTrayInstance;
});
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This mock now defines MockTrayConstructorInline inside the vi.mock factory, but the file still keeps the top-level MockTrayConstructor with identical behavior. Since it’s no longer used, it adds duplication and makes it unclear which mock should be asserted against; remove the unused top-level constructor (or reuse a single hoist-safe mock) to keep the test maintainable.

Copilot uses AI. Check for mistakes.
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.

2 participants