Skip to content

test: add unit tests for getArchitecture and getAvx2 Windows ARM64 fallback logic#153

Merged
xhyrom merged 6 commits intofeat/win32-arm64-fallback-to-x64from
copilot/sub-pr-131
Jan 5, 2026
Merged

test: add unit tests for getArchitecture and getAvx2 Windows ARM64 fallback logic#153
xhyrom merged 6 commits intofeat/win32-arm64-fallback-to-x64from
copilot/sub-pr-131

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 4, 2026

Addresses review feedback requesting test coverage for the getArchitecture function's Windows ARM64→x64 fallback behavior. Also includes tests for the getAvx2 function merged from the base branch.

Changes

  • New test file: tests/utils.spec.ts with 14 test cases covering:
    • getArchitecture tests (7 tests):
      • Windows with arm64/aarch64 → returns x64 + emits warning
      • Linux/macOS with arm64 → returns aarch64 (no warning)
      • Other architectures (x64, x86) → pass-through unchanged
      • Warning message content validation
    • getAvx2 tests (7 tests):
      • Windows ARM64 platforms → always returns false
      • Non-Windows ARM64 platforms → respects provided avx2 parameter or defaults to true
      • x64 platforms → respects provided avx2 parameter or defaults to true

Test Coverage

// getArchitecture: Verifies fallback behavior
getArchitecture("windows", "arm64")    // → "x64" + warning
getArchitecture("windows", "aarch64")  // → "x64" + warning

// getArchitecture: Verifies no fallback on non-Windows
getArchitecture("linux", "arm64")      // → "aarch64"
getArchitecture("darwin", "arm64")     // → "aarch64"

// getArchitecture: Verifies pass-through
getArchitecture("windows", "x64")      // → "x64"

// getAvx2: Verifies Windows ARM64 always disables AVX2
getAvx2("windows", "arm64", true)      // → false
getAvx2("windows", "aarch64", false)   // → false

All tests use proper spy cleanup to avoid cross-test pollution.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update fallback arm64 to x64 architecture for win32 platform Add unit tests for getArchitecture Windows ARM64 fallback logic Jan 4, 2026
Copilot AI requested a review from xhyrom January 4, 2026 23:36
@xhyrom xhyrom changed the title Add unit tests for getArchitecture Windows ARM64 fallback logic test: add unit tests for getArchitecture Windows ARM64 fallback logic Jan 4, 2026
@xhyrom xhyrom marked this pull request as ready for review January 4, 2026 23:58
Copilot AI review requested due to automatic review settings January 4, 2026 23:59
Copy link
Copy Markdown
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 adds comprehensive unit test coverage for the getArchitecture function in src/utils.ts, specifically focusing on the Windows ARM64 to x64 fallback behavior. The tests verify that Windows ARM64 systems fall back to x64 with appropriate warnings, while other platforms handle ARM64 natively.

Key changes:

  • Added 8 test cases covering Windows ARM64 fallback, non-Windows ARM64 handling, and architecture pass-through behavior
  • Implemented proper spy management with cleanup to prevent test pollution
  • Validated warning message content for Windows ARM64 scenarios

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

@xhyrom
Copy link
Copy Markdown
Collaborator

xhyrom commented Jan 5, 2026

@copilot resolve conflicts

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 5, 2026

@copilot resolve conflicts

Conflicts resolved! The tests/utils.spec.ts file now contains both getArchitecture tests (from this PR) and getAvx2 tests (from the base branch PR #131). All 33 tests pass successfully. Changes committed in ffe2255.

Copilot AI changed the title test: add unit tests for getArchitecture Windows ARM64 fallback logic test: add unit tests for getArchitecture and getAvx2 Windows ARM64 fallback logic Jan 5, 2026
Copilot AI requested a review from xhyrom January 5, 2026 00:08
@xhyrom xhyrom merged commit 0789115 into feat/win32-arm64-fallback-to-x64 Jan 5, 2026
71 checks passed
@xhyrom xhyrom deleted the copilot/sub-pr-131 branch January 5, 2026 00:10
xhyrom added a commit that referenced this pull request Jan 5, 2026
* feat: fallback arm64 to x64 architecture for win32 platform

closes #130

* [autofix.ci] apply automated fixes

* ci: test on windows-11-arm runner

* refactor: move logic to getEffectiveArch func

* [autofix.ci] apply automated fixes

* feat: add warning message for windows arm64 fallback to x64

* [autofix.ci] apply automated fixes

* feat: don't mention arch in warning msg aboout fallback

* [autofix.ci] apply automated fixes

* debug time

* [autofix.ci] apply automated fixes

* feat: force baseline for win32 arm fallback to x64

* [autofix.ci] apply automated fixes

* ci: dont use windows-11-arm on setup bun from download url

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* apply changes

Co-authored-by: Copilot <[email protected]>

* [autofix.ci] apply automated fixes

* docs: clarify

* [autofix.ci] apply automated fixes

* test: add unit tests for getAvx2 Windows ARM64 fallback logic (#154)

* Initial plan

* Add unit tests for getAvx2 function

Co-authored-by: xhyrom <[email protected]>

* Consolidate duplicate test assertions in getAvx2 tests

Co-authored-by: xhyrom <[email protected]>

* Fix whitespace formatting in test file

Co-authored-by: xhyrom <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: xhyrom <[email protected]>

* test: add unit tests for getArchitecture and getAvx2 Windows ARM64 fallback logic (#153)

* Initial plan

* Add unit tests for getArchitecture function

Co-authored-by: xhyrom <[email protected]>

* Remove unused import in utils.spec.ts

Co-authored-by: xhyrom <[email protected]>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <[email protected]>

* Merge pr-131 and resolve test file conflicts

Co-authored-by: xhyrom <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: xhyrom <[email protected]>
Co-authored-by: Jozef Steinhübl <[email protected]>
Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
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.

3 participants