Skip to content

Fix test coverage failures#5839

Merged
christopherholland-workday merged 4 commits intomainfrom
coverage
Feb 24, 2026
Merged

Fix test coverage failures#5839
christopherholland-workday merged 4 commits intomainfrom
coverage

Conversation

@christopherholland-workday
Copy link
Copy Markdown
Contributor

@christopherholland-workday christopherholland-workday commented Feb 24, 2026

Fixing pnpm test:coverage failures in GH actions

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @christopherholland-workday, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses and resolves test coverage failures within the agentflow package by refining its testing infrastructure. The changes involve creating a specialized TypeScript configuration for tests and enhancing the module import mechanism for the JSDOM test environment, ensuring more stable and accurate test execution.

Highlights

  • Jest Configuration Update: Updated the Jest configuration for the agentflow package to utilize a dedicated tsconfig.test.json file for TypeScript compilation during tests, ensuring specific settings are applied for the testing environment.
  • New TypeScript Test Configuration: Introduced a new tsconfig.test.json file that extends the base tsconfig.json but overrides compilerOptions to set module to CommonJS and moduleResolution to node, which is often necessary for Jest's execution environment.
  • JSDOM Environment Import Enhancement: Modified the import logic for JSDOMEnvironment in jest-environment-jsdom.js to robustly handle different module export patterns (default export or direct module export) from the jest-environment-jsdom package, improving compatibility.
Changelog
  • packages/agentflow/jest.config.js
    • Updated the tsconfig reference from tsconfig.json to tsconfig.test.json within the ts-jest transformer configuration.
  • packages/agentflow/src/test_utils/jest-environment-jsdom.js
    • Modified the import of JSDOMEnvironment to use a more resilient pattern (jestJsdom.default ?? jestJsdom) to account for variations in module exports.
  • packages/agentflow/tsconfig.test.json
    • Added a new TypeScript configuration file specifically for testing, extending the base tsconfig.json and setting module to CommonJS and moduleResolution to node.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses test coverage failures by refining the Jest and TypeScript configurations. The changes introduce a dedicated "tsconfig.test.json" for test compilation and enhance the "jest-environment-jsdom" import mechanism for improved compatibility. These adjustments contribute to a more robust and reliable testing setup.

'ts-jest',
{
tsconfig: 'tsconfig.json'
tsconfig: 'tsconfig.test.json'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Changing the tsconfig to tsconfig.test.json is a good practice. It allows for specific TypeScript compilation settings for tests, which can differ from the main application's build settings (e.g., module resolution, target environment). This helps prevent conflicts and ensures tests are compiled optimally.

Comment on lines +13 to +15
const jestJsdom = require('jest-environment-jsdom')

const JSDOMEnvironment = jestJsdom.default ?? jestJsdom
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The use of the nullish coalescing operator (??) to handle jest-environment-jsdom's export is a robust improvement. It correctly accounts for scenarios where the module might export its default directly or as a named export, ensuring compatibility across different environments or module versions.

Comment on lines +1 to +7
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "node"
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This new tsconfig.test.json file is well-configured for Jest's CommonJS environment. Explicitly setting module: "CommonJS" and moduleResolution: "node" ensures that TypeScript compiles test files in a way that Jest can understand, resolving potential module resolution issues that might arise with ESNext or bundler settings in a standard tsconfig.json.

@christopherholland-workday christopherholland-workday marked this pull request as ready for review February 24, 2026 20:56
@christopherholland-workday christopherholland-workday merged commit 3ba827d into main Feb 24, 2026
7 checks passed
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