Fix test coverage failures#5839
Conversation
Summary of ChangesHello @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 Highlights
Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
packages/agentflow/jest.config.js
Outdated
| 'ts-jest', | ||
| { | ||
| tsconfig: 'tsconfig.json' | ||
| tsconfig: 'tsconfig.test.json' |
There was a problem hiding this comment.
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.
| const jestJsdom = require('jest-environment-jsdom') | ||
|
|
||
| const JSDOMEnvironment = jestJsdom.default ?? jestJsdom |
There was a problem hiding this comment.
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "module": "CommonJS", | ||
| "moduleResolution": "node" | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
Fixing
pnpm test:coveragefailures in GH actions