-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Unsupported Darwin Platform Causes Test Failures on macOS #287
Comments
@coderabbitai based on these observations, what do you recommend? Considering the CI runs on Linux and will catch failing tests, should we skip the tests when we detect we're on Darwin? If so, please suggest a fix. |
Tip For best results, initiate chat on the files or code changes. @GabLeRoux, based on your observations, I recommend adjusting the tests to ensure they pass on macOS without skipping them. Since the CI runs on Linux and will catch any platform-specific issues, making the tests platform-independent where possible will improve the developer experience on macOS. One effective approach is to mock the Here's how you can modify your // At the top of your image-tag.test.ts file
const originalPlatform = process.platform;
beforeAll(() => {
Object.defineProperty(process, 'platform', {
value: 'linux',
});
});
afterAll(() => {
Object.defineProperty(process, 'platform', {
value: originalPlatform,
});
}); This code temporarily overrides Alternatively, if you prefer to conditionally skip the platform-specific tests on unsupported platforms, you can adjust your test suites as follows: const isSupportedPlatform = ['linux', 'win32'].includes(process.platform);
if (isSupportedPlatform) {
describe('ImageTag', () => {
// Place your tests here
});
} else {
describe.skip('ImageTag', () => {
// Tests are skipped on unsupported platforms
});
} However, mocking Let me know if this solution works for you or if you need further assistance! 🔗 Analysis chain🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Find and output the contents of 'image-tag.ts' and 'platform.ts' to analyze platform detection logic
fd 'image-tag.ts' --type f --exec cat {}
fd 'platform.ts' --type f --exec cat {}
Length of output: 5643 |
Bug Description:
When committing changes on macOS (Darwin), certain tests fail due to Darwin not being recognized as a supported platform. Specifically, the
ImageTag
tests return errors, indicating that Darwin is unsupported, which blocks successful test execution on macOS systems.How to Reproduce:
Expected Behavior:
Tests should either support the Darwin platform or handle unsupported platforms gracefully without causing test failures.
Failing Test Details:
Error example:
Additional Details:
The tests should ideally support Darwin, or if that is not feasible, an alternative handling method should be implemented to prevent these failures on macOS systems.
Complete output of the `yarn test` command executed on macOS
This works fine on Windows or Linux, but we cannot commit easily on macOS at this time because
husky
runs the tests when we commit. Workaround is to use--no-verify
parameter when we commit on this project, which is not ideal.Example:
The text was updated successfully, but these errors were encountered: