Skip to content

Fix test suite failures caused by ESM-only @octokit/core and probot dependencies#938

Merged
decyjphr merged 3 commits intodependabot/npm_and_yarn/probot-14.2.4from
copilot/fix-github-actions-workflow
Mar 2, 2026
Merged

Fix test suite failures caused by ESM-only @octokit/core and probot dependencies#938
decyjphr merged 3 commits intodependabot/npm_and_yarn/probot-14.2.4from
copilot/fix-github-actions-workflow

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

Two unit test suites were failing to load because @octokit/core and probot are now ESM-only packages ("type": "module") and cannot be consumed via require().

Changes

  • test/unit/lib/settings.test.js: Removed require('@octokit/core'). Octokit was only used as a mock property container via jest.mocked() — replaced with a local empty class:

    // Before
    const { Octokit } = require('@octokit/core')
    
    // After
    class Octokit {}
  • test/unit/index.test.js: Added jest.mock('probot', ...) to short-circuit the ESM load. All tests in this file are already describe.skip'd; the suite was failing purely at the module loading stage.

    jest.mock('probot', () => ({ Probot: class Probot {} }))
    const { Probot } = require('probot')
Original prompt

Fix the failing GitHub Actions workflow test (20)
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 65474740419
Job URL: https://github.com/github/safe-settings/actions/runs/22598567041/job/65474740419


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits March 2, 2026 22:30
Co-authored-by: decyjphr <57544838+decyjphr@users.noreply.github.com>
Co-authored-by: decyjphr <57544838+decyjphr@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow test Fix test suite failures caused by ESM-only @octokit/core and probot dependencies Mar 2, 2026
@decyjphr decyjphr marked this pull request as ready for review March 2, 2026 22:40
Copilot AI review requested due to automatic review settings March 2, 2026 22:40
@decyjphr decyjphr merged commit 4905b0a into dependabot/npm_and_yarn/probot-14.2.4 Mar 2, 2026
2 checks passed
@decyjphr decyjphr deleted the copilot/fix-github-actions-workflow branch March 2, 2026 22:41
Copy link
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 fixes two failing unit test suites caused by @octokit/core and probot being ESM-only packages ("type": "module") that cannot be consumed via require() in Jest's CommonJS environment.

Changes:

  • Replaced the require('@octokit/core') import in settings.test.js with a local empty stub class, which works identically given that jest.mocked() in plain JavaScript simply returns the class constructor.
  • Added a jest.mock('probot', ...) call in index.test.js to short-circuit the ESM module load, since all tests in that file are already describe.skip'd and the failure was purely at module-load time.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
test/unit/lib/settings.test.js Replaces ESM require('@octokit/core') with a local empty class Octokit {} stub
test/unit/index.test.js Adds jest.mock('probot', ...) to prevent ESM-load failure at module resolution time

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

decyjphr added a commit that referenced this pull request Mar 3, 2026
* build(deps): bump probot from 13.4.4 to 14.2.4

Bumps [probot](https://github.com/probot/probot) from 13.4.4 to 14.2.4.
- [Release notes](https://github.com/probot/probot/releases)
- [Commits](probot/probot@v13.4.4...v14.2.4)

---
updated-dependencies:
- dependency-name: probot
  dependency-version: 14.2.4
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix test suite failures caused by ESM-only `@octokit/core` and `probot` dependencies (#938)

* Initial plan

* Initial plan for fixing failing test suites

Co-authored-by: decyjphr <57544838+decyjphr@users.noreply.github.com>

* Fix failing test suites caused by ESM-only dependencies

Co-authored-by: decyjphr <57544838+decyjphr@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: decyjphr <57544838+decyjphr@users.noreply.github.com>

* Update minimatch dependency version to 10.2.1

* Fix devcontainer configuration and update dependencies (#942)

* fix devcontainer

* Update .devcontainer/Dockerfile

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .devcontainer/Dockerfile

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .devcontainer/devcontainer.json

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <57544838+decyjphr@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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