Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to run tests on non-x64 architecture #502

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ganta
Copy link
Contributor

@ganta ganta commented May 30, 2022

Description:
The test fails when run on non-x86 architectures such as Apple Silicon.

The return value of os.arch() can be replaced using Jest's spyOn() so that tests can be run on non-x86 architectures, but this does not work as expected in certain cases.

archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']);

In this case, os.arch() is called with the default parameter, so it cannot be replaced.
https://github.com/actions/toolkit/blob/8263c4d15d3a8616851e9c7762ce46fbb4f8c552/packages/tool-cache/src/tool-cache.ts#L638

Therefore, I have changed it to pass values instead of relying on default values.

Related issue:

N/A

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@ganta ganta requested a review from a team May 30, 2022 16:00
@ganta ganta force-pushed the fix-to-run-tests-on-non-x86-arch branch from 0b2230a to b858c04 Compare March 22, 2023 02:12
@ganta ganta requested a review from a team as a code owner March 22, 2023 02:12
@ganta
Copy link
Contributor Author

ganta commented Mar 22, 2023

I have resolved the conflict. Could you please reconfirm?

deining pushed a commit to deining/setup-node that referenced this pull request Nov 9, 2023
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