Skip to content

Conversation

@KubrickCode
Copy link
Owner

Add integration test to verify logger.warn calls and file skipping behavior when large files are mixed with valid files in a directory

fix #89

Add integration test to verify logger.warn calls and file skipping behavior when large files are mixed with valid files in a directory

fix #89
@gemini-code-assist
Copy link

Summary of Changes

Hello @KubrickCode, 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 introduces a crucial integration test to validate the system's behavior when encountering oversized files during the file collection process. The test ensures that files exceeding the maximum allowed size are correctly identified and skipped, preventing their inclusion, while simultaneously confirming that other valid files in the same directory are processed as expected. This enhancement improves the robustness of the file handling logic and verifies the intended file skipping behavior.

Highlights

  • Integration Test for File Size Warnings: Added a new integration test to src/pkg/push/files.spec.ts to verify that the collectFiles function correctly skips files that exceed the MAX_FILE_SIZE_MB while still collecting valid files from the same directory.
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.

@github-actions github-actions bot added the refactor Refactoring code label Nov 18, 2025
@KubrickCode
Copy link
Owner Author

/gemini review

@KubrickCode KubrickCode merged commit 8bbd2d2 into main Nov 18, 2025
8 checks passed
Copy link

@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 adds an integration test to verify the behavior of collectFiles when encountering files that exceed the maximum size limit. The test correctly checks that oversized files are skipped. However, it misses a key part of the intended behavior verification: ensuring that a warning is logged for each skipped file. I've added a suggestion to include this check, which will make the test more robust and fully align with the PR's goal.

Comment on lines +129 to +142
it("should skip files exceeding max size and collect valid files", async () => {
await mkdir(join(testDir, "src"), { recursive: true });

const largeContent = "x".repeat(MAX_FILE_SIZE_MB * 1024 * 1024);
await writeFile(join(testDir, "src/large.ts"), largeContent);
await writeFile(join(testDir, "src/small.ts"), "small content");

const files = await collectFiles("src", testDir);

// Should only collect the small file, skipping the large one
expect(files).toHaveLength(1);
expect(files[0]?.path).toBe("src/small.ts");
expect(files[0]?.content).toBe("small content");
});

Choose a reason for hiding this comment

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

medium

This test correctly verifies that large files are skipped, but it's missing a key verification mentioned in the pull request description: checking that logger.warn is called. To make the test complete, you should spy on logger.warn and assert that it has been called. I've also updated the test description to reflect this.

You'll need to add the following import at the top of the file:

import { logger } from "../../internal/utils/logger.js";
    it("should skip files exceeding max size, log a warning, and collect valid files", async () => {
      const warnSpy = jest.spyOn(logger, "warn").mockImplementation(() => {});

      await mkdir(join(testDir, "src"), { recursive: true });

      const largeContent = "x".repeat(MAX_FILE_SIZE_MB * 1024 * 1024);
      await writeFile(join(testDir, "src/large.ts"), largeContent);
      await writeFile(join(testDir, "src/small.ts"), "small content");

      const files = await collectFiles("src", testDir);

      // Should only collect the small file, skipping the large one
      expect(files).toHaveLength(1);
      expect(files[0]?.path).toBe("src/small.ts");
      expect(files[0]?.content).toBe("small content");

      // Should log a warning for the skipped file
      expect(warnSpy).toHaveBeenCalledTimes(1);
      expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("exceeds maximum"));

      warnSpy.mockRestore();
    });

@KubrickCode KubrickCode deleted the develop/shlee/89 branch November 20, 2025 01:02
KubrickCode pushed a commit that referenced this pull request Nov 20, 2025
## [1.0.5](v1.0.4...v1.0.5) (2025-11-20)

### 🔧 Maintenance

* add logger and github-client utilities ([](6196258)), closes [#72](#72)
* add logger behavior verification for file size warnings ([](06f82e9)), closes [#89](#89)
* add NetworkError and ValidationError classes ([](4e09739)), closes [#71](#71)
* apply barrel export pattern and clean up import paths ([](04ce850)), closes [#100](#100)
* apply custom error classes to executor.ts ([](8b78d58)), closes [#73](#73)
* apply custom error classes to pull/index.ts ([](ccb01b1)), closes [#74](#74)
* apply logger utility across entire project ([](0821077)), closes [#72](#72)
* decompose baedal function to reduce complexity ([](15db919)), closes [#74](#74)
* decompose executePush function to reduce complexity ([](c2404c4)), closes [#73](#73)
* enhance CLI option validation in adapter ([](15f325d)), closes [#93](#93)
* implement 2-tier release notes structure ([](8c5eaf0))
* implement BaseError and FileSystemError classes (based on ts-custom-error) ([](ef2e9fc)), closes [#68](#68)
* improve coverage by 12% with integration tests ([](3912f18)), closes [#75](#75)
* Merge branch 'main' into develop/shlee/68 ([](5e1aec2))
* Merge pull request #101 from KubrickCode/develop/shlee/100 ([](abfe334)), closes [#101](#101)
* Merge pull request #81 from KubrickCode/develop/shlee/67 ([](ebaed6a)), closes [#81](#81)
* Merge pull request #82 from KubrickCode/develop/shlee/68 ([](cf27101)), closes [#82](#82)
* Merge pull request #83 from KubrickCode/develop/shlee/69,70 ([](5310670)), closes [#83](#83)
* Merge pull request #84 from KubrickCode/develop/shlee/71 ([](961437a)), closes [#84](#84)
* Merge pull request #85 from KubrickCode/develop/shlee/72,73 ([](4fe566e)), closes [#85](#85)
* Merge pull request #86 from KubrickCode/develop/shlee/74 ([](1623d2c)), closes [#86](#86)
* Merge pull request #87 from KubrickCode/develop/shlee/75 ([](ecd9868)), closes [#87](#87)
* Merge pull request #96 from KubrickCode/develop/shlee/88 ([](716527b)), closes [#96](#96)
* Merge pull request #97 from KubrickCode/develop/shlee/89 ([](8bbd2d2)), closes [#97](#97)
* Merge pull request #98 from KubrickCode/develop/shlee/90 ([](c30c5ed)), closes [#98](#98)
* Merge pull request #99 from KubrickCode/develop/shlee/92 ([](0e6f4e3)), closes [#99](#99)
* Merge remote-tracking branch 'origin/release' ([](3d585f5))
* move pull public types to pkg/pull/types.ts ([](82943f2))
* pnpm link command failing due to missing global environment setup ([](216c118))
* refactor extract module and add path-helpers utilities ([](3c33d1a)), closes [#69](#69) [#70](#70)
* remove unused token parameter from parseSource ([](e6dc4a6)), closes [#91](#91)
* reorganize internal modules into core/domain/infra/utils structure ([](c3a07d5))
* resolve immutable commit object error in transform function ([](6e1e853))
* restructure folders following NPM guidelines ([](587c956)), closes [#67](#67)
* split extractTarball into strategy pattern ([](7edcb25)), closes [#92](#92)
* standardize error handling in download and files modules ([](4619732)), closes [#88](#88)
* unify Octokit instantiation with github-client utility ([](92ea5fd)), closes [#72](#72)
* Update README ([](d64cf7e))
* Update README, CLAUDE ([](2e4d8a9)), closes [#76](#76)
* utilize Provider type and improve extensibility ([](f773d1c)), closes [#90](#90)
@KubrickCode
Copy link
Owner Author

🎉 This PR is included in version 1.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

refactor Refactoring code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize logging - files.ts

2 participants