Skip to content

test: add case for import-js/eslint-import-resolver-typescript#429#76

Merged
JounQin merged 2 commits intomainfrom
fix/resolve_ts_extension
Apr 21, 2025
Merged

test: add case for import-js/eslint-import-resolver-typescript#429#76
JounQin merged 2 commits intomainfrom
fix/resolve_ts_extension

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Apr 21, 2025

Summary by CodeRabbit

  • Tests
    • Added a new test to verify that requests for .ts files correctly resolve to .d.ts files, enhancing coverage of file extension resolution behavior.

Important

Add test for .ts to .d.ts resolution and fix typo in parse_query_fragment() function name.

  • Tests:
    • Added test in extensions.rs to verify .ts files resolve to .d.ts files.
  • Fixes:
    • Corrected typo in parse_query_fragment() function name in specifier.rs.

This description was created by Ellipsis for de19677. You can customize this summary. It will automatically update as commits are pushed.

@JounQin JounQin requested a review from Copilot April 21, 2025 08:09
@coderabbitai
Copy link

coderabbitai bot commented Apr 21, 2025

Walkthrough

A new test case has been added to the multi_dot_extension test function in the src/tests/extensions.rs file. This test case checks that a request for "./bar.ts" correctly resolves to "bar.d.ts", expanding the test coverage for file resolution logic involving .ts and .d.ts extensions. Additionally, a typo in the method name parse_query_framgment was corrected to parse_query_fragment in src/specifier.rs. No changes have been made to any exported or public entities beyond the method name correction.

Changes

File(s) Change Summary
src/tests/extensions.rs Added a new entry to the multi_dot_extension test to verify .ts requests resolve to .d.ts
src/specifier.rs Fixed typo in method name: parse_query_framgmentparse_query_fragment

Assessment against linked issues

Objective Addressed Explanation
Ensure that requests for ./foo.ts resolve to ./foo.d.ts as in versions prior to 3.9.0 (#429)

Poem

A whisk of code, a test anew,
For .ts to .d.ts, we now pursue.
With every hop, our checks expand,
Ensuring resolvers work as planned.
In burrows deep, where logic lies,
The rabbit cheers with sparkling eyes! 🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 08e0b6a and 3f01a7a.

📒 Files selected for processing (2)
  • src/specifier.rs (1 hunks)
  • src/tests/extensions.rs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/specifier.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tests/extensions.rs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test (windows-latest)

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

Copy link

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

The PR adds a failing test case to capture a specific edge-case in module resolution related to .d.ts files for .ts files.

  • Introduces a new test tuple to validate the expected resolution of "./bar.ts" to "bar.d.ts".
  • Enhances the test suite for resolving file extensions.
Comments suppressed due to low confidence (1)

src/tests/extensions.rs:98

  • [nitpick] Consider adding an inline comment explaining the rationale behind expecting .d.ts to be resolved from a .ts file, to improve clarity for future maintainers.
        ("should resolve .d.ts for .ts", "./bar.ts", "bar.d.ts"),

@JounQin
Copy link
Member Author

JounQin commented Apr 21, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Apr 21, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@JounQin JounQin force-pushed the fix/resolve_ts_extension branch from 08e0b6a to de19677 Compare April 21, 2025 09:22
@JounQin JounQin changed the title test: add failing pnp case for import-js/eslint-import-resolver-typescript#429 test: add case for import-js/eslint-import-resolver-typescript#429 Apr 21, 2025
@JounQin JounQin marked this pull request as ready for review April 21, 2025 09:22
@sonarqubecloud
Copy link

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to de19677 in 55 seconds. Click for details.
  • Reviewed 45 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/specifier.rs:25
  • Draft comment:
    Typo fix: Renaming parse_query_framgment to parse_query_fragment improves clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. src/tests/extensions.rs:91
  • Draft comment:
    New test case for alias resolution: Validates that './bar.ts' correctly resolves to 'bar.d.ts'.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. src/specifier.rs:25
  • Draft comment:
    Typo fix: renamed call from 'parse_query_framgment' to 'parse_query_fragment', enhancing readability.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, pointing out a typo fix that enhances readability. It does not provide a suggestion, ask for confirmation, or highlight a potential issue.
4. src/tests/extensions.rs:101
  • Draft comment:
    New test case added to verify that extension aliasing correctly resolves '.ts' requests to '.d.ts' when no '.ts' file exists.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, describing a new test case that was added. It does not provide any suggestions, ask for confirmation, or point out any issues.
5. src/specifier.rs:32
  • Draft comment:
    Typographical error was present in the function name (parse_query_framgment). It has been corrected to parse_query_fragment. This ensures consistency and improves code readability.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, pointing out a typographical correction. It doesn't suggest any action or ask for confirmation about the change. It simply states what was done and why, which violates the rule against purely informative comments.

Workflow ID: wflow_hgjJx9gCAfhQQF6E

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@codecov
Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.22%. Comparing base (8009e6a) to head (3f01a7a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #76   +/-   ##
=======================================
  Coverage   93.22%   93.22%           
=======================================
  Files          13       13           
  Lines        2850     2850           
=======================================
  Hits         2657     2657           
  Misses        193      193           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 21, 2025

CodSpeed Performance Report

Merging #76 will not alter performance

Comparing fix/resolve_ts_extension (3f01a7a) with main (8009e6a)

Summary

✅ 3 untouched benchmarks

@JounQin JounQin merged commit 888207d into main Apr 21, 2025
21 checks passed
@JounQin JounQin deleted the fix/resolve_ts_extension branch April 21, 2025 09:30
@JounQin JounQin mentioned this pull request Apr 21, 2025
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