Skip to content

test: Fix test failures by specifying initial branch name in git init #6872

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

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

Conversation

WooWan
Copy link

@WooWan WooWan commented Aug 10, 2025

What's the problem this PR addresses?

This PR adds --initial-branch=master option to ensure consistent test behavior across different development environments.

Git has used main as the default branch for quite some time now, while our tests expect master. When I ran the integration tests with my default configuration (using main), they failed due to this mismatch.
This change ensures tests pass reliably regardless of local git configuration and lowers the barrier to entry for new contributors!

Example error:

 FAIL  pkg-tests-specs/sources/commands/version/check.test.js (13.598 s)
  ● Commands › version check › it shouldn't detect a change when pulling master

    Temporary fixture folder: /private/var/folders/y2/dwrgd4rx32n7phb939mny5p00000gn/T/xfs-46e897df/test

    Command failed: git checkout master
    error: pathspec 'master' did not match any file(s) known to git


    ===== stdout:

    ```
    ```

    ===== stderr:

    ```
    error: pathspec 'master' did not match any file(s) known to git
    ```

...

How did you fix it?

Explicitly set initial branch to master to ensure consistent test behavior.

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

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.

1 participant