Skip to content

fix: mock github checks in tests#723

Closed
frostebite wants to merge 5 commits intomainfrom
codex/fix-fetch-implementation-issue-in-tests
Closed

fix: mock github checks in tests#723
frostebite wants to merge 5 commits intomainfrom
codex/fix-fetch-implementation-issue-in-tests

Conversation

@frostebite
Copy link
Member

@frostebite frostebite commented Aug 2, 2025

Very small PR. Improving stability/fix for occasional fail on a test for coordinator/cloud runner.

Mocks a github check API which very occasionally fails.

Summary

  • polyfill fetch using undici for jest
  • mock github check requests to avoid network dependency in tests

Testing

  • cloudRunnerTests=true node node_modules/jest/bin/jest.js cloud-runner-github-checks --detectOpenHandles --forceExit --runInBand

https://chatgpt.com/s/cd_688fab13de4c81918a329e14fe7b8284

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests
    • Improved test reliability by mocking GitHub API calls in the Cloud Runner Github Checks test suite, ensuring tests run without external dependencies.
    • Enhanced Jest test setup with a polyfill for the fetch API, preventing test failures related to missing global fetch-related APIs.
    • Added a new integration test suite for Cloud Runner GitHub Checks to validate real interactions with GitHub during workflows.
  • Chores
    • Introduced a new optional parameter to the CI workflow enabling manual execution of GitHub Checks integration tests.

@coderabbitai
Copy link

coderabbitai bot commented Aug 2, 2025

📝 Walkthrough

Walkthrough

The Jest setup now unconditionally polyfills fetch, Headers, Request, and Response from undici for the testing environment. The Cloud Runner Github Checks test suite was refactored to always run with mocked GitHub API methods. A new GitHub Actions job was added to run integration tests conditionally, supported by a new integration test file that interacts with real GitHub checks.

Changes

Cohort / File(s) Change Summary
Jest Global Fetch Polyfill
src/jest.setup.ts
Unconditionally polyfills global fetch, Headers, Request, and Response using undici to support Octokit in Jest tests.
Cloud Runner GitHub Checks Unit Tests
src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts
Refactors tests to always run with mocked GitHub API methods via beforeEach and afterEach hooks; removes conditional test execution.
GitHub Actions Workflow Update
.github/workflows/cloud-runner-ci-pipeline.yml
Adds optional input runGithubIntegrationTests for manual dispatch; introduces githubChecksIntegration job to run integration tests conditionally.
Cloud Runner GitHub Checks Integration Test
src/integration/cloud-runner-github-checks.integration.test.ts
Adds new integration test suite that runs real GitHub checks conditionally based on environment variable, with long timeout support.

Sequence Diagram(s)

sequenceDiagram
    participant TestSuite as Cloud Runner Github Checks Unit Tests
    participant GitHubAPI as GitHub API Module

    TestSuite->>GitHubAPI: Mock createGitHubCheckRequest
    TestSuite->>GitHubAPI: Mock updateGitHubCheckRequest
    TestSuite->>GitHubAPI: Mock runUpdateAsyncChecksWorkflow
    TestSuite->>GitHubAPI: Run tests using mocked methods
    TestSuite->>GitHubAPI: Restore original methods after each test
Loading
sequenceDiagram
    participant GitHubActions as GitHub Actions Workflow
    participant Runner as Test Runner
    participant GitHub as GitHub API

    GitHubActions->>Runner: Trigger githubChecksIntegration job (if runGithubIntegrationTests = true)
    Runner->>GitHub: Run real integration tests (create & update GitHub checks)
    GitHub-->>Runner: Return check IDs and statuses
    Runner-->>GitHubActions: Report test results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A fetch appears, no need to guess,
The tests now run with clean finesse.
GitHub calls are softly mocked,
While integration checks are clocked.
In pipelines swift, the rabbits cheer,
With code so fresh, the path is clear!
🐰🚀✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-fetch-implementation-issue-in-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

github-actions bot commented Aug 2, 2025

Cat Gif

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/jest.setup.ts (1)

12-19: Remove unnecessary ESLint disable comments.

The @typescript-eslint/no-explicit-any disable comments are flagged as unused by ESLint, suggesting TypeScript isn't reporting errors for these type assertions in this context.

-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
   (global as any).fetch = fetch;
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
   (global as any).Headers = Headers;
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
   (global as any).Request = Request;
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
   (global as any).Response = Response;
src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts (1)

30-32: Fix formatting and remove useless undefined.

Address the Prettier formatting and ESLint issues flagged by static analysis.

-      jest
-        .spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow')
-        .mockResolvedValue(undefined);
+      jest.spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow').mockResolvedValue();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e91ca9 and 44586b3.

📒 Files selected for processing (2)
  • src/jest.setup.ts (1 hunks)
  • src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts (1 hunks)
🧰 Additional context used
🪛 ESLint
src/jest.setup.ts

[error] 12-12: '@typescript-eslint/no-explicit-any' rule is disabled but never reported.

(eslint-comments/no-unused-disable)


[error] 14-14: '@typescript-eslint/no-explicit-any' rule is disabled but never reported.

(eslint-comments/no-unused-disable)


[error] 16-16: '@typescript-eslint/no-explicit-any' rule is disabled but never reported.

(eslint-comments/no-unused-disable)


[error] 18-18: '@typescript-eslint/no-explicit-any' rule is disabled but never reported.

(eslint-comments/no-unused-disable)

src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts

[error] 30-32: Replace ⏎········.spyOn(GitHub·as·any,·'runUpdateAsyncChecksWorkflow')⏎········ with .spyOn(GitHub·as·any,·'runUpdateAsyncChecksWorkflow')

(prettier/prettier)


[error] 32-32: Do not use useless undefined.

(unicorn/no-useless-undefined)

🪛 GitHub Actions: Integrity
src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts

[warning] 1-1: Prettier formatting check failed. Code style issues found. Forgot to run Prettier?

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: iOS on 2022.3.13f1
  • GitHub Check: A cat for your effort!
  • GitHub Check: WebGL on 2022.3.13f1
  • GitHub Check: StandaloneWindows64 on 2023.2.2f1
  • GitHub Check: StandaloneOSX on 2023.2.2f1
  • GitHub Check: WebGL on 2021.3.32f1
  • GitHub Check: StandaloneOSX on 2022.3.13f1
  • GitHub Check: StandaloneWindows64 on 2021.3.32f1
  • GitHub Check: iOS on 2021.3.32f1
  • GitHub Check: Android on 2021.3.32f1
  • GitHub Check: StandaloneOSX on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2021.3.32f1
  • GitHub Check: StandaloneWindows64 on 2021.3.32f1
🔇 Additional comments (3)
src/jest.setup.ts (1)

3-21: LGTM! Clean polyfill implementation for Jest testing.

The conditional polyfill for fetch API using undici is well-implemented and properly documented. This addresses the common issue where Jest's VM context lacks fetch globals even on Node 18+.

src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts (2)

20-37: Good test isolation with GitHub API mocking.

The mocking setup effectively prevents real network calls during tests and provides controlled responses. The conditional application based on cloudRunnerDebug is appropriate.


1-79: Formatting issues resolved via Prettier

I’ve run npx prettier --write src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts, which fixed the formatting errors that were causing the pipeline to fail. Please commit the updated file to restore CI green status.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts (1)

22-29: Streamline stubbing via jest.mock

Three repeated spyOn calls can be replaced with a single module mock, reducing repetition and easing future maintenance.

jest.mock('../../github', () => ({
  createGitHubCheckRequest: jest.fn().mockResolvedValue({ status: 201, data: { id: '1' } }),
  updateGitHubCheckRequest: jest.fn().mockResolvedValue({ status: 200, data: {} }),
  runUpdateAsyncChecksWorkflow: jest.fn().mockResolvedValue(),
}));
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44586b3 and b924651.

📒 Files selected for processing (1)
  • src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts (1 hunks)
🧰 Additional context used
🪛 ESLint
src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts

[error] 30-30: Do not use useless undefined.

(unicorn/no-useless-undefined)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: Android on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2023.2.2f1
  • GitHub Check: Android on 2022.3.13f1
  • GitHub Check: iOS on 2022.3.13f1
  • GitHub Check: StandaloneWindows64 on 2022.3.13f1
  • GitHub Check: Android on 2021.3.32f1
  • GitHub Check: iOS on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2022.3.13f1
  • GitHub Check: StandaloneLinux64 on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2021.3.32f1
  • GitHub Check: StandaloneOSX on 2021.3.32f1
  • GitHub Check: StandaloneWindows64 on 2021.3.32f1
  • GitHub Check: StandaloneLinux64 on 2021.3.32f1
  • GitHub Check: StandaloneWindows64 on 2021.3.32f1
  • GitHub Check: iOS on 2023.2.2f1
  • GitHub Check: StandaloneOSX on 2022.3.13f1
  • GitHub Check: iOS on 2021.3.45f1
  • GitHub Check: iOS on 2022.3.13f1
  • GitHub Check: StandaloneOSX on 2021.3.45f1

status: 200,
data: {},
});
jest.spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow').mockResolvedValue(undefined);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

mockResolvedValue(undefined) triggers ESLint unicorn/no-useless-undefined

Omit the argument—mockResolvedValue() already resolves with undefined.

-jest.spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow').mockResolvedValue(undefined);
+jest.spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow').mockResolvedValue();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
jest.spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow').mockResolvedValue(undefined);
jest.spyOn(GitHub as any, 'runUpdateAsyncChecksWorkflow').mockResolvedValue();
🧰 Tools
🪛 ESLint

[error] 30-30: Do not use useless undefined.

(unicorn/no-useless-undefined)

🤖 Prompt for AI Agents
In src/model/cloud-runner/tests/cloud-runner-github-checks.test.ts at line 30,
the call to mockResolvedValue(undefined) triggers an ESLint
unicorn/no-useless-undefined warning because mockResolvedValue() without
arguments already resolves with undefined. Fix this by removing the undefined
argument and just use mockResolvedValue() instead.

@codecov
Copy link

codecov bot commented Aug 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 38.22%. Comparing base (9e91ca9) to head (d6dc078).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #723      +/-   ##
==========================================
+ Coverage   37.05%   38.22%   +1.16%     
==========================================
  Files          77       77              
  Lines        3163     3163              
  Branches      626      662      +36     
==========================================
+ Hits         1172     1209      +37     
+ Misses       1991     1809     -182     
- Partials        0      145     +145     

see 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cloudymax
Copy link
Member

cloudymax commented Aug 3, 2025

Seems reasonable, but since my TS is not very strong I would need to ask:

  1. Why is it needed to disable certain eslint options?
  2. Could mocking the github return values lead to tests passing erroneously in the event a github API changes?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/jest.setup.ts (1)

3-11: LGTM! Excellent solution for Jest fetch polyfill.

The fetch polyfill implementation correctly addresses the issue where Jest's VM context lacks the fetch API even on Node 18+. The approach of using undici's implementation and assigning it to globalThis is the standard pattern for this scenario.

The ESLint error about globalThis not being defined is a false positive - globalThis is available in Node.js 12+ and all modern environments. Consider adding globalThis to your ESLint globals configuration to resolve this warning.

To resolve the ESLint warning, you can add this to your ESLint configuration:

{
  "globals": {
+   "globalThis": "readonly"
  }
}
src/integration/cloud-runner-github-checks.integration.test.ts (2)

31-34: Consider cleanup of created GitHub checks.

The test creates real GitHub checks but doesn't clean them up afterward. Over time, this could accumulate test artifacts in the GitHub repository.

Consider adding cleanup logic:

     const checkId = await GitHub.createGitHubCheck(`integration create`);
     expect(checkId).not.toEqual('');
     await GitHub.updateGitHubCheck(`1 ${new Date().toISOString()}`, `integration`);
     await GitHub.updateGitHubCheck(`2 ${new Date().toISOString()}`, `integration`, `success`, `completed`);
+    
+    // Optional: Clean up the created check if the GitHub API supports it
+    // await GitHub.deleteGitHubCheck?.(checkId);

36-36: Consider using a more reasonable timeout.

The infinite timeout (1e9 ms ≈ 11.5 days) could mask actual issues and prevent proper test failure detection.

Consider using a more reasonable timeout for integration tests:

-    TIMEOUT_INFINITE,
+    300000, // 5 minutes - adjust based on expected GitHub API response times
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6dc078 and 05a3792.

📒 Files selected for processing (3)
  • .github/workflows/cloud-runner-ci-pipeline.yml (2 hunks)
  • src/integration/cloud-runner-github-checks.integration.test.ts (1 hunks)
  • src/jest.setup.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: the build steps duplication in the workflow is intentional to implement a retry mechanism with diffe...
Learnt from: MichaelBuhler
PR: game-ci/unity-builder#685
File: .github/workflows/build-tests-ubuntu.yml:146-146
Timestamp: 2025-01-30T18:01:50.339Z
Learning: The build steps duplication in the workflow is intentional to implement a retry mechanism with different delay intervals between attempts.

Applied to files:

  • .github/workflows/cloud-runner-ci-pipeline.yml
🪛 GitHub Check: Tests
src/integration/cloud-runner-github-checks.integration.test.ts

[failure] 1-1:
Filename 'cloud-runner-github-checks.integration.test.ts' does not match the naming convention

🪛 ESLint
src/integration/cloud-runner-github-checks.integration.test.ts

[error] 1-39: Filename 'cloud-runner-github-checks.integration.test.ts' does not match the naming convention.

(filenames/match-regex)

src/jest.setup.ts

[error] 11-11: 'globalThis' is not defined.

(no-undef)

🪛 GitHub Actions: Integrity
src/integration/cloud-runner-github-checks.integration.test.ts

[error] 1-1: ESLint: Filename 'cloud-runner-github-checks.integration.test.ts' does not match the naming convention (filenames/match-regex)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: StandaloneOSX on 2021.3.32f1
  • GitHub Check: StandaloneWindows64 on 2021.3.32f1
  • GitHub Check: StandaloneOSX on 2023.2.2f1
  • GitHub Check: iOS on 2023.2.2f1
  • GitHub Check: StandaloneWindows64 on 2023.2.2f1
  • GitHub Check: StandaloneOSX on 2022.3.13f1
  • GitHub Check: Android on 2023.2.2f1
  • GitHub Check: StandaloneOSX on 2021.3.45f1
  • GitHub Check: iOS on 2022.3.13f1
  • GitHub Check: tvOS on 2022.3.13f1
  • GitHub Check: StandaloneWindows64 on 2023.2.2f1
  • GitHub Check: WSAPlayer on 2021.3.32f1
  • GitHub Check: StandaloneWindows64 on 2022.3.13f1
  • GitHub Check: Android on 2022.3.13f1
  • GitHub Check: WSAPlayer on 2022.3.13f1
  • GitHub Check: Android on 2021.3.32f1
  • GitHub Check: StandaloneWindows64 on 2021.3.32f1
  • GitHub Check: tvOS on 2021.3.32f1
🔇 Additional comments (3)
src/integration/cloud-runner-github-checks.integration.test.ts (1)

16-17: LGTM! Clean conditional test execution.

The conditional execution logic using environment variables is well-implemented and allows for precise control over when integration tests run.

.github/workflows/cloud-runner-ci-pipeline.yml (2)

6-10: LGTM! Well-designed manual workflow dispatch input.

The workflow dispatch input parameter is properly configured with appropriate description, required flag, and default value. This allows for controlled execution of integration tests without affecting regular CI runs.


216-231: LGTM! Excellent integration test job implementation.

The githubChecksIntegration job is well-structured with:

  • Proper conditional execution based on workflow dispatch input
  • Correct environment variable setup for the integration test
  • Standard Node.js setup with yarn caching
  • Appropriate Jest flags for integration testing
  • Proper secret handling for GitHub token authentication

The implementation follows GitHub Actions best practices and integrates seamlessly with the existing CI pipeline.

@@ -0,0 +1,38 @@
import { BuildParameters } from '../model';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix filename to match naming convention.

The filename violates the project's naming convention as indicated by ESLint and pipeline failures.

Consider renaming the file to match the expected pattern. Based on the error, you may need to use a different naming convention such as:

-cloud-runner-github-checks.integration.test.ts
+cloud-runner-github-checks-integration.test.ts

Or check your ESLint configuration for the expected filename pattern and adjust accordingly.

🧰 Tools
🪛 GitHub Check: Tests

[failure] 1-1:
Filename 'cloud-runner-github-checks.integration.test.ts' does not match the naming convention

🪛 ESLint

[error] 1-39: Filename 'cloud-runner-github-checks.integration.test.ts' does not match the naming convention.

(filenames/match-regex)

🪛 GitHub Actions: Integrity

[error] 1-1: ESLint: Filename 'cloud-runner-github-checks.integration.test.ts' does not match the naming convention (filenames/match-regex)

🤖 Prompt for AI Agents
In src/integration/cloud-runner-github-checks.integration.test.ts at line 1, the
filename does not conform to the project's naming conventions causing ESLint and
pipeline failures. Rename the file to match the expected pattern defined in the
ESLint configuration or project guidelines, such as adjusting the order or
format of segments in the filename to comply with the naming rules.

@frostebite
Copy link
Member Author

Seems reasonable, but since my TS is not very strong I would need to ask:

  1. Why is it needed to disable certain eslint options?
  2. Could mocking the github return values lead to tests passing erroneously in the event a github API changes?

• Why is it needed to disable certain ESLint options? — The only disables are for camelcase where the GitHub API requires snake_case fields, so we suppress the camelCase rule around those API payload keys.

• Could mocking the GitHub return values lead to tests passing erroneously if the GitHub API changes? — Mocking keeps unit tests deterministic and offline. To catch breaking API changes, we added an optional integration test (RUN_GITHUB_INTEGRATION_TESTS) that exercises real GitHub checks, providing a safety net for API regressions.

@cloudymax

@cloudymax
Copy link
Member

Thanks for the explanation! - Approved 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants