Skip to content

test: sync enhanced-resolve test cases#182

Open
stormslowly wants to merge 8 commits intomainfrom
chore/sync_enhanced_resolve
Open

test: sync enhanced-resolve test cases#182
stormslowly wants to merge 8 commits intomainfrom
chore/sync_enhanced_resolve

Conversation

@stormslowly
Copy link
Collaborator

Sync enhanced-resolve test cases

Keep failed test cases as skipped, for later follow-up.

Migrate to rstest

Copilot AI review requested due to automatic review settings March 23, 2026 07:40
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 focuses on enhancing the NAPI resolver's test coverage and modernizing its testing infrastructure. It involves a complete migration of the resolver's test suite from ava to rstest, alongside the integration of a comprehensive set of test cases from the upstream enhanced-resolve project. This synchronization aims to improve the robustness and compatibility of the NAPI resolver, with some identified test cases temporarily skipped for future work.

Highlights

  • Test Suite Migration: The testing framework for the NAPI resolver has been migrated from ava to rstest, a new testing framework. This involves removing old ava test files and introducing new rstest-based test files.
  • Enhanced-Resolve Test Case Synchronization: A significant number of test cases from the enhanced-resolve project have been synchronized and added to the NAPI resolver's test suite. These new tests cover various aspects of resolution, including exportsField, importsField, tsconfig-paths, browserField, extension-alias, extensions, restrictions, roots, and scoped-packages.
  • Skipped Test Cases: Some of the newly synchronized enhanced-resolve test cases are currently skipped, indicating known differences or areas requiring further follow-up and implementation.
  • Configuration Updates: The .prettierignore file has been updated to include a new malformed tsconfig.json fixture, and the package.json scripts have been modified to reflect the rstest migration.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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

@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 successfully migrates the test suite from ava to rstest and synchronizes a significant number of test cases from enhanced-resolve. The strategy of marking failing or unsupported tests as skipped with clear explanations is an excellent way to manage and track future work. The updates to package.json and the new rstest configuration files are appropriate for this migration. I have one suggestion to enhance the robustness of one of the new configuration files.

Copy link
Contributor

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

Updates the resolver’s test suite by syncing a large set of enhanced-resolve compatibility fixtures/cases and migrating the JavaScript test runner to @rstest/core, while keeping currently failing cases marked as skipped for follow-up.

Changes:

  • Replace AVA/node:test usage with @rstest/core and add rstest config files + updated package.json scripts.
  • Add/port many enhanced-resolve compatibility tests into napi/tests/** and napi/__test__/**.
  • Add new enhanced-resolve fixture content (tsconfig-paths, exports/imports cases, unsafe-cache-normalization, etc.) and minor docs/formatting updates.

Reviewed changes

Copilot reviewed 87 out of 89 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
rstest.config.resolver.mjs Adds rstest config for napi/__test__ suite (incl. externals for native bindings/WASI).
rstest.config.mjs Adds rstest config for napi/tests enhanced-resolve-compatible suite (externals for native binding).
pnpm-lock.yaml Updates lockfile to include rstest and related dependency graph changes.
package.json Switches test scripts to rstest and updates devDependencies (removes AVA, adds @rstest/core).
napi/tests/tsconfig-paths.test.mjs Adds enhanced-resolve tsconfig-paths compatibility tests (incl. skipped known gaps).
napi/tests/scoped-packages.test.mjs Adds scoped package resolution tests.
napi/tests/roots.test.mjs Adds tests for roots option behavior.
napi/tests/restrictions.test.mjs Adds tests for restrictions behavior (incl. skipped known gap).
napi/tests/resolve.test.mjs Adds general resolve behavior tests (ported cases).
napi/tests/options.test.mjs Migrates options tests to rstest/expect assertions.
napi/tests/incorrect-description-file.test.mjs Adds tests for incorrect package.json description file behavior.
napi/tests/importsField.test.mjs Adds imports field resolution tests (incl. skipped known gaps).
napi/tests/extensions.test.mjs Adds extension resolution ordering/edge case tests.
napi/tests/extension-alias.test.mjs Adds extensionAlias behavior tests.
napi/tests/exportsField.test.mjs Adds extensive exports field compatibility tests (with documented skips).
napi/tests/browserField.test.mjs Adds browser field aliasing behavior tests.
napi/test/resolver.test.mjs Replaces AVA resolver suite with rstest-based suite (incl. parameterized cases + WASI conditional).
napi/test/resolver.spec.mjs Removes old AVA-based resolver test file.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/shared/index.js Adds unsafe-cache-normalization fixture module.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/components/index.js Fixture file for unsafe-cache-normalization scenario.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/b/index.js Adds unsafe-cache-normalization fixture module.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/a/b/index.js Adds unsafe-cache-normalization nested fixture module.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/src/index.js Adds nested package fixture entry.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/package.json Adds nested package fixture manifest.
fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/package.json Adds root fixture manifest.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/tsconfig.json Adds project-references fixture tsconfig.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/src/main.ts Adds project-references fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/tsconfig.json Adds utils referenced-project tsconfig fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/src/core/date.ts Adds utils referenced-project fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/tsconfig.json Adds shared referenced-project tsconfig fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/utils/helper.ts Adds shared referenced-project fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/index.ts Adds shared referenced-project fixture entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/components/Input.ts Adds shared referenced-project component fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/index.ts Adds shared package root fixture entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/tsconfig.json Adds app referenced-project tsconfig fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/index.ts Adds app referenced-project fixture entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/components/Button.ts Adds app referenced-project component fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/malformed-json/tsconfig.json Adds malformed-json fixture for error handling.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/tsconfig.json Adds JSONC-with-comments tsconfig fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/foo/index.ts Adds JSONC fixture mapped source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/bar/index.ts Adds JSONC fixture mapped source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/components/button.ts Adds JSONC fixture component source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/tsconfig.json Adds tsconfig extends-package-entry fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/tsconfig.json Adds tsconfig extends-from-npm fixture.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/utils/date.ts Adds extends-npm fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/index.ts Adds extends-npm fixture entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/components/button.ts Adds extends-npm fixture component.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/tsconfig.json Adds deep-extends baseUrl fixture base config.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/src/utils/format.ts Adds deep-extends fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/lib/tsconfig.json Adds deep-extends fixture intermediate tsconfig.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/app/tsconfig.json Adds deep-extends fixture app tsconfig.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/tsconfig.json Adds circular-extends fixture tsconfig (b).
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/src/util/bar.ts Adds circular-extends fixture source (b).
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/tsconfig.json Adds circular-extends fixture tsconfig (a).
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/src/lib/foo.ts Adds circular-extends fixture source (a).
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/tsconfig.json Adds base-extends fixture tsconfig.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/utils/date.ts Adds base-extends fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/index.ts Adds base-extends fixture entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/components/button.ts Adds base-extends fixture component.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/tsconfig.json Adds base tsconfig-paths fixture config with mappings.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/utils/date.ts Adds base tsconfig-paths fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/refs/index.ts Adds base tsconfig-paths refs fixture module.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/star-bar/index.ts Adds base tsconfig-paths star mapping fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/package.json Adds no-main-field package fixture manifest.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/index.ts Adds no-main-field package fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/package.json Adds main-field package fixture manifest.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/node.ts Adds main-field package fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/package.json Adds browser-field package fixture manifest.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/node.ts Adds browser-field package fixture node entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/browser.ts Adds browser-field package fixture browser entry.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/two.ts Adds longest-prefix fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/three.ts Adds longest-prefix fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/one.ts Adds longest-prefix fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/foo/index.ts Adds mapped foo fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/bar/file1.ts Adds mapped bar/* fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/index.ts Adds base fixture entry that exercises path mappings.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/new-file.ts Adds remap target fixture source.
fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/button.ts Adds component fixture source.
fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/utils.js Adds imports slash-pattern fixture module.
fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/nested/deep.js Adds nested imports slash-pattern fixture module.
fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/package.json Adds imports slash-pattern fixture manifest.
fixtures/enhanced_resolve/test/fixtures/imports-field-different/package.json Adds “imports-field-different” fixture manifest.
fixtures/enhanced_resolve/test/fixtures/imports-field-different/a.js Adds imports-field-different fixture module.
fixtures/enhanced_resolve/test/fixtures/imports-field-chain/the.js Adds imports-field-chain fixture module.
fixtures/enhanced_resolve/test/fixtures/imports-field-chain/package.json Adds imports-field-chain fixture manifest.
fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/package.json Adds invalid exports target fixture manifest.
fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/a.js Adds invalid exports target fixture module.
README.md Adjusts the options table formatting in documentation.
.prettierignore Ignores the intentionally malformed tsconfig fixture for formatting.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +13
"test": "npm run test:resolver && npm run test:enhanced-resolve-compatible",
"test:resolver": "rstest run -c rstest.config.resolver.mjs",
"test:enhanced-resolve-compatible": "rstest run -c rstest.config.mjs",
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

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

The test script shells out to npm run ... even though the repo is pinned to pnpm (and CI uses pnpm test). Using pnpm run test:resolver / pnpm run test:enhanced-resolve-compatible avoids mixing package managers and tends to behave more consistently across environments.

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5a9105916

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 23, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing chore/sync_enhanced_resolve (8c52218) with main (b36ec51)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (670b541) during the generation of this report, so b36ec51 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

stormslowly and others added 2 commits March 23, 2026 15:51
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@stormslowly stormslowly requested a review from hardfist March 23, 2026 08:17
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