Skip to content

unable to run unit tests locally when pull.rebase is set to true in global gitconfig #6924

@shiftkey

Description

@shiftkey

Description

I've been working on the rebase flows and it turns out that some tests rely on the defaults for pull.rebase being unset. This is annoying because I want to test things with pull.rebase enabled and I'm sick of having to unset and then set this again in config.

Version

  • GitHub Desktop: 1cf334b
  • Operating system: macOS

Steps to Reproduce

  1. git config --global pull.rebase true
  2. yarn to ensure dependencies are up to date
  3. yarn test:unit to run all Git tests

Expected Behavior

No errors reported.

Actual Behavior

...

Summary of all failing tests
FAIL test/unit/git/pull/only-behind-test.ts (10.885s)
  ● git/pull › only behind tracking branch › with pull.ff=false set in config › creates a merge commit

    expect(received).toHaveLength(length)

    Expected value to have length:
      2
    Received:
      ["20f77e80666cbe45ac2e20dc4748358aad927fd1"]
    received.length:
      1

      109 |       it('creates a merge commit', async () => {
      110 |         expect(newTip.sha).not.toBe(previousTip.sha)
    > 111 |         expect(newTip.parentSHAs).toHaveLength(2)
          |                                   ^
      112 |       })
      113 |
      114 |       it('is different from remote branch', async () => {

      at Object.it (test/unit/git/pull/only-behind-test.ts:111:35)

  ● git/pull › only behind tracking branch › with pull.ff=false set in config › is different from remote branch

    expect(received).not.toBe(expected) // Object.is equality

    Expected: "ec5268a042195b6f8c76fbaeb4cb7d75a8963073"
    Received: "ec5268a042195b6f8c76fbaeb4cb7d75a8963073"

      114 |       it('is different from remote branch', async () => {
      115 |         const remoteCommit = await getRefOrError(repository, remoteBranch)
    > 116 |         expect(remoteCommit.sha).not.toBe(newTip.sha)
          |                                      ^
      117 |       })
      118 |
      119 |       it('is now ahead of tracking branch', async () => {

      at Object.it (test/unit/git/pull/only-behind-test.ts:116:38)

  ● git/pull › only behind tracking branch › with pull.ff=false set in config › is now ahead of tracking branch

    expect(received).toEqual(expected)

    Expected value to equal:
      {"ahead": 1, "behind": 0}
    Received:
      {"ahead": 0, "behind": 0}

    Difference:

    - Expected
    + Received

      Object {
    -   "ahead": 1,
    +   "ahead": 0,
        "behind": 0,
      }

      121 |
      122 |         const aheadBehind = await getAheadBehind(repository, range)
    > 123 |         expect(aheadBehind).toEqual({
          |                             ^
      124 |           ahead: 1,
      125 |           behind: 0,
      126 |         })

      at Object.it (test/unit/git/pull/only-behind-test.ts:123:29)

FAIL test/unit/git/pull/ahead-and-behind-test.ts (12.057s)
  ● git/pull › ahead and behind of tracking branch › by default › creates a merge commit

    expect(received).toHaveLength(length)

    Expected value to have length:
      2
    Received:
      ["336ab75af8ff09ad6106db3ce5e57eeb1367f91e"]
    received.length:
      1

      71 |
      72 |         expect(newTip.sha).not.toBe(previousTip.sha)
    > 73 |         expect(newTip.parentSHAs).toHaveLength(2)
         |                                   ^
      74 |       })
      75 |
      76 |       it('is different from remote branch', async () => {

      at Object.it (test/unit/git/pull/ahead-and-behind-test.ts:73:35)

  ● git/pull › ahead and behind of tracking branch › by default › is ahead of tracking branch

    expect(received).toEqual(expected)

    Expected value to equal:
      {"ahead": 2, "behind": 0}
    Received:
      {"ahead": 1, "behind": 0}

    Difference:

    - Expected
    + Received

      Object {
    -   "ahead": 2,
    +   "ahead": 1,
        "behind": 0,
      }

      86 |
      87 |         const aheadBehind = await getAheadBehind(repository, range)
    > 88 |         expect(aheadBehind).toEqual({
         |                             ^
      89 |           ahead: 2,
      90 |           behind: 0,
      91 |         })

      at Object.it (test/unit/git/pull/ahead-and-behind-test.ts:88:29)

  ● git/pull › ahead and behind of tracking branch › with pull.ff=false set in config › creates a merge commit

    expect(received).toHaveLength(length)

    Expected value to have length:
      2
    Received:
      ["b2237737d9f43ef47dd3f9582a8d3389fc1e39b5"]
    received.length:
      1

      112 |       it('creates a merge commit', async () => {
      113 |         expect(newTip.sha).not.toBe(previousTip.sha)
    > 114 |         expect(newTip.parentSHAs).toHaveLength(2)
          |                                   ^
      115 |       })
      116 |
      117 |       it('is ahead of tracking branch', async () => {

      at Object.it (test/unit/git/pull/ahead-and-behind-test.ts:114:35)

  ● git/pull › ahead and behind of tracking branch › with pull.ff=false set in config › is ahead of tracking branch

    expect(received).toEqual(expected)

    Expected value to equal:
      {"ahead": 2, "behind": 0}
    Received:
      {"ahead": 1, "behind": 0}

    Difference:

    - Expected
    + Received

      Object {
    -   "ahead": 2,
    +   "ahead": 1,
        "behind": 0,
      }

      122 |
      123 |         const aheadBehind = await getAheadBehind(repository, range)
    > 124 |         expect(aheadBehind).toEqual({
          |                             ^
      125 |           ahead: 2,
      126 |           behind: 0,
      127 |         })

      at Object.it (test/unit/git/pull/ahead-and-behind-test.ts:124:29)


Test Suites: 2 failed, 83 passed, 85 total
Tests:       7 failed, 3 skipped, 719 passed, 729 total
Snapshots:   0 total
Time:        16.344s

Additional Information

N/A

Metadata

Metadata

Assignees

Labels

tech-debtIssues and pull requests related to addressing technical debt or improving the codebase

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions