Skip to content

🧪 [testing improvement] Add unit tests for centralized errorHandler#50

Open
TargetMisser wants to merge 1 commit intomainfrom
test/error-handler-coverage-8773425034696330984
Open

🧪 [testing improvement] Add unit tests for centralized errorHandler#50
TargetMisser wants to merge 1 commit intomainfrom
test/error-handler-coverage-8773425034696330984

Conversation

@TargetMisser
Copy link
Copy Markdown
Owner

🎯 What: The centralized error handler (src/utils/errorHandler.ts) lacked unit tests, creating a gap in verifying our primary error reporting mechanism.

📊 Coverage: The new test suite covers:

  • Standard Error object handling (console + UI alert).
  • String and non-Error object handling.
  • Falsy/empty message fallbacks to ensure the user always sees a message.
  • The silent = true background execution path (ensuring no UI alert is triggered).

Result: Increased test coverage for our core utility, ensuring confident refactoring and reliable error reporting without regressions. Also properly scaffolded Jest for the React Native/Expo project environment.


PR created automatically by Jules for task 8773425034696330984 started by @TargetMisser

Adds a comprehensive test suite for the shared errorHandler utility,
including setup for Jest with Expo and React Native mocking.

Co-authored-by: TargetMisser <52361977+TargetMisser@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flight-work-app Ready Ready Preview, Comment, Open in v0 Apr 7, 2026 5:52pm

Copy link
Copy Markdown

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

Adds a Jest-based unit test suite for the shared handleError utility and introduces initial Jest configuration/dependencies to support testing in this Expo/React Native project.

Changes:

  • Added unit tests validating handleError console logging, alert behavior, fallback messaging, and silent mode.
  • Added a jest-expo-based Jest configuration.
  • Added Jest-related devDependencies to support running the new tests.

Reviewed changes

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

File Description
src/utils/errorHandler.test.ts New unit tests for the centralized handleError utility.
jest.config.js Adds Jest preset/config for Expo + RN module transforms.
package.json Adds Jest tooling dependencies to enable running the new test suite.

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

Comment on lines +39 to +42
"@types/jest": "^30.0.0",
"@types/react": "~19.1.10",
"jest": "^30.3.0",
"jest-expo": "^55.0.14",
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

jest-expo 55.x is likely incompatible with the project's Expo SDK (~54.0.0) and it also brings Jest 29.x tooling in its dependency tree. Adding jest@^30.3.0 here can cause version/peer-dependency conflicts (and may make the jest binary resolve to the wrong implementation). Align jest-expo to the Expo major version and use the corresponding supported Jest version (or rely on jest-expo’s bundled Jest).

Suggested change
"@types/jest": "^30.0.0",
"@types/react": "~19.1.10",
"jest": "^30.3.0",
"jest-expo": "^55.0.14",
"@types/jest": "^29.5.14",
"@types/react": "~19.1.10",
"jest-expo": "^54.0.0",

Copilot uses AI. Check for mistakes.
"jest": "^30.3.0",
"jest-expo": "^55.0.14",
"pdfjs-dist": "^5.6.205",
"ts-jest": "^29.4.9",
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

ts-jest is added as a devDependency but the Jest config uses the jest-expo preset and does not configure ts-jest as a transformer. If you’re not explicitly using ts-jest, it’s better to remove it to avoid extra dependency weight and potential Jest version alignment issues; otherwise, configure Jest to actually use it.

Suggested change
"ts-jest": "^29.4.9",

Copilot uses AI. Check for mistakes.
Comment on lines +39 to 45
"@types/jest": "^30.0.0",
"@types/react": "~19.1.10",
"jest": "^30.3.0",
"jest-expo": "^55.0.14",
"pdfjs-dist": "^5.6.205",
"ts-jest": "^29.4.9",
"typescript": "~5.9.2"
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

This adds Jest dependencies but package.json still has no test/test:watch script, which makes the new test suite hard to run consistently (and easy to miss in CI/local workflows). Consider adding a test script that invokes Jest with this config/preset.

Copilot uses AI. Check for mistakes.
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.

2 participants