Skip to content

chore: add correct test case for #409 #441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged

chore: add correct test case for #409 #441

merged 1 commit into from
Apr 21, 2025

Conversation

JounQin
Copy link
Collaborator

@JounQin JounQin commented Apr 21, 2025

Important

Remove nestedPackageJson test case and update dependencies in unit tests.

  • Tests:
    • Remove nestedPackageJson test case from e2e.spec.ts.snap.
    • Delete nestedPackageJson related files: .eslintrc.cjs, .gitignore, package.json, and test.ts.
    • Add @atlaskit/pragmatic-drag-and-drop to devDependencies in pnp/package.json.
    • Add test for @atlaskit/pragmatic-drag-and-drop/combine in unit.spec.ts.

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

Summary by CodeRabbit

  • Tests

    • Removed the nestedPackageJson test directory and its related configuration and test files.
    • Added a new test to verify module resolution for '@atlaskit/pragmatic-drag-and-drop/combine' in Plug'n'Play environments.
    • Updated test dependencies to include '@atlaskit/pragmatic-drag-and-drop'.
  • Chores

    • Cleaned up unnecessary configuration and package files in the nestedPackageJson test directory.

@JounQin JounQin requested a review from Copilot April 21, 2025 07:30
Copy link

changeset-bot bot commented Apr 21, 2025

⚠️ No Changeset found

Latest commit: 87cf0f4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Apr 21, 2025

Walkthrough

This change removes the entire nestedPackageJson test directory, including its configuration files, test file, and package metadata. The .gitignore in that directory is also modified to stop ignoring .yarn files. Meanwhile, the @atlaskit/pragmatic-drag-and-drop dependency is added to the tests/unit/pnp package, and a new test assertion is introduced in unit.spec.ts to verify module resolution for this dependency in a Plug'n'Play environment.

Changes

File(s) Change Summary
tests/e2e/nestedPackageJson/.eslintrc.cjs, package.json, test.ts, tsconfig.json Deleted all files, removing the nestedPackageJson test directory and its configuration, test, and setup
tests/e2e/nestedPackageJson/.gitignore Removed .yarn/* from ignore list, so .yarn files will now be tracked
tests/unit/pnp/package.json Added @atlaskit/pragmatic-drag-and-drop as a devDependency
tests/unit/unit.spec.ts Added a test assertion to check module resolution for the new dependency in a pnp environment

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant Resolver
    participant PnPEnvironment

    TestRunner->>Resolver: Request resolve('@atlaskit/pragmatic-drag-and-drop/combine')
    Resolver->>PnPEnvironment: Locate module in pnp cache
    PnPEnvironment-->>Resolver: Return resolved path to .d.ts file
    Resolver-->>TestRunner: Return found result with resolved path
Loading

Suggested reviewers

  • SukkaW

Poem

In the warren of tests, some files hopped away,
No more nested configs to lead us astray.
A new drag-and-drop joins the unit test fun,
With PnP resolving, our checks are well done.
As the garden is tidied, new growth takes root—
Hop, hop, hooray for a codebase acute! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

yarn install v1.22.22
warning Resolution field "workspace:" has an invalid version entry and may be ignored
[1/4] Resolving packages...
error Couldn't find any versions for "eslint-import-resolver-typescript" that matches "workspace:
"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


📜 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 bd45fcd and 87cf0f4.

⛔ Files ignored due to path filters (8)
  • tests/e2e/__snapshots__/e2e.spec.ts.snap is excluded by !**/*.snap
  • tests/e2e/nestedPackageJson/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
  • tests/unit/pnp/.yarn/cache/@atlaskit-pragmatic-drag-and-drop-npm-1.5.2-3241d4f843-1dace49fa3.zip is excluded by !**/.yarn/**, !**/*.zip
  • tests/unit/pnp/.yarn/cache/@babel-runtime-npm-7.27.0-67ce9cb54f-35091ea9de.zip is excluded by !**/.yarn/**, !**/*.zip
  • tests/unit/pnp/.yarn/cache/bind-event-listener-npm-3.0.0-c29621e676-08eadf1c7d.zip is excluded by !**/.yarn/**, !**/*.zip
  • tests/unit/pnp/.yarn/cache/raf-schd-npm-4.0.3-18f72af738-ecabf0957c.zip is excluded by !**/.yarn/**, !**/*.zip
  • tests/unit/pnp/.yarn/cache/regenerator-runtime-npm-0.14.1-a6c97c609a-1b16eb2c4b.zip is excluded by !**/.yarn/**, !**/*.zip
  • tests/unit/pnp/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • tests/e2e/nestedPackageJson/.eslintrc.cjs (0 hunks)
  • tests/e2e/nestedPackageJson/.gitignore (0 hunks)
  • tests/e2e/nestedPackageJson/package.json (0 hunks)
  • tests/e2e/nestedPackageJson/test.ts (0 hunks)
  • tests/e2e/nestedPackageJson/tsconfig.json (0 hunks)
  • tests/unit/pnp/package.json (1 hunks)
  • tests/unit/unit.spec.ts (1 hunks)
💤 Files with no reviewable changes (5)
  • tests/e2e/nestedPackageJson/.gitignore
  • tests/e2e/nestedPackageJson/package.json
  • tests/e2e/nestedPackageJson/tsconfig.json
  • tests/e2e/nestedPackageJson/test.ts
  • tests/e2e/nestedPackageJson/.eslintrc.cjs
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
🔇 Additional comments (2)
tests/unit/pnp/package.json (1)

6-6: New dependency added correctly for PnP testing

Adding @atlaskit/pragmatic-drag-and-drop as a dev dependency here aligns with the overall changes in this PR. This dependency supports the new test case added to unit.spec.ts that verifies module resolution in a Plug'n'Play environment.

tests/unit/unit.spec.ts (1)

40-47: Well-structured test case for PnP resolution

This new test assertion properly verifies that the TypeScript import resolver can correctly resolve the @atlaskit/pragmatic-drag-and-drop/combine module in a Plug'n'Play environment. The test follows the same pattern as the existing assertions and uses snapshot testing to verify the expected resolution path.

This is a good addition that improves test coverage for issue #409 by consolidating the tests previously located in the now-removed nested package directory.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

This PR updates the test suite to correctly address issue #409 by adding a new unit test and cleaning up outdated configurations from the end-to-end tests.

  • Adds a unit test case for verifying the resolution of '@atlaskit/pragmatic-drag-and-drop/combine'
  • Removes obsolete export and ESLint configuration from nestedPackageJson tests

Reviewed Changes

Copilot reviewed 10 out of 15 changed files in this pull request and generated no comments.

File Description
tests/unit/unit.spec.ts Added a new unit test using an inline snapshot to validate the resolver.
tests/e2e/nestedPackageJson/test.ts Removed unused export related to the outdated package reference.
tests/e2e/nestedPackageJson/.eslintrc.cjs Removed obsolete ESLint configuration pointing to the base config.
Files not reviewed (5)
  • tests/e2e/snapshots/e2e.spec.ts.snap: Language not supported
  • tests/e2e/nestedPackageJson/.gitignore: Language not supported
  • tests/e2e/nestedPackageJson/package.json: Language not supported
  • tests/e2e/nestedPackageJson/tsconfig.json: Language not supported
  • tests/unit/pnp/package.json: Language not supported
Comments suppressed due to low confidence (1)

tests/unit/unit.spec.ts:40

  • [nitpick] Consider adding a brief comment above the snapshot assertion to clarify the reasoning behind expecting the resolver to return { "found": false } for '@atlaskit/pragmatic-drag-and-drop/combine'.
expect(

Copy link

codesandbox-ci bot commented Apr 21, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.45%. Comparing base (bd45fcd) to head (87cf0f4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #441   +/-   ##
=======================================
  Coverage   64.45%   64.45%           
=======================================
  Files           6        6           
  Lines         377      377           
  Branches       48       49    +1     
=======================================
  Hits          243      243           
  Misses        134      134           

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

Copy link

pkg-pr-new bot commented Apr 21, 2025

Open in StackBlitz

npm i https://pkg.pr.new/eslint-import-resolver-typescript@441

commit: 87cf0f4

Copy link
Contributor

github-actions bot commented Apr 21, 2025

size-limit report 📦

Path Size
lib/index.js 1.4 KB (0%)

@JounQin JounQin marked this pull request as ready for review April 21, 2025 12:31
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 87cf0f4 in 55 seconds. Click for details.
  • Reviewed 86 lines of code in 7 files
  • Skipped 8 files when reviewing.
  • Skipped posting 9 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. tests/e2e/__snapshots__/e2e.spec.ts.snap:64
  • Draft comment:
    Removed nestedPackageJson snapshot. Ensure related test files and references are removed to avoid stale snapshots.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
2. tests/e2e/nestedPackageJson/.eslintrc.cjs:1
  • Draft comment:
    Deleted file for nestedPackageJson ESLint config. Confirm that removal of nested package tests is intentional and does not break any dependent tests.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. tests/unit/pnp/package.json:6
  • Draft comment:
    Added dependency '@atlaskit/pragmatic-drag-and-drop'. Verify that the version (^1.5.2) matches what is expected in other parts of the project for consistency.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to verify the version of a dependency, which is related to dependencies. According to the rules, comments on dependencies should be ignored unless they are about specific version mismatches that need confirmation. This comment is asking for verification, which is not allowed.
4. tests/unit/unit.spec.ts:40
  • Draft comment:
    New snapshot expectation for '@atlaskit/pragmatic-drag-and-drop/combine' added. Ensure this matches the actual output and that the test file for resolution is updated accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that the snapshot matches the actual output and that the test file is updated. This falls under asking the author to ensure something is tested or verified, which is against the rules.
5. tests/e2e/__snapshots__/e2e.spec.ts.snap:59
  • Draft comment:
    Removal of the 'nestedPackageJson' snapshot appears intentional. Ensure that its removal aligns with the deletion of corresponding tests.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. tests/e2e/nestedPackageJson/.eslintrc.cjs:1
7. tests/unit/pnp/package.json:6
  • Draft comment:
    Added '@atlaskit/pragmatic-drag-and-drop' dependency. Verify that version '^1.5.2' is correct and compatible with PnP resolution tests.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify the version of a dependency, which is against the rules. It is not making a specific suggestion or pointing out a specific issue with the code.
8. tests/unit/unit.spec.ts:41
  • Draft comment:
    New inline snapshot test for '@atlaskit/pragmatic-drag-and-drop/combine' added. Ensure the resolved path remains valid if dependency structure changes.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that the resolved path remains valid if the dependency structure changes. This is a request for the author to double-check something, which violates the rules.
9. tests/e2e/__snapshots__/e2e.spec.ts.snap:43
  • Draft comment:
    Typo noticed: The snapshot key 'multipleEslintrcs' might be intended to be 'multipleEslintrc'. Please verify and correct if necessary.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_hjXiR7xT85YmvUX1

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

@JounQin JounQin merged commit 748795f into master Apr 21, 2025
32 checks passed
@JounQin JounQin deleted the test/cases branch April 21, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant