Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: implement thedefaultAsyncResolver#15679

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
cpojer merged 3 commits intojestjs:mainfromJounQin:feat/defaultAsyncResolver
Jun 14, 2025

Conversation

@JounQin
Copy link
Collaborator

@JounQinJounQin commentedJun 13, 2025
edited
Loading

Summary

Follow up#15619 (comment)

packageFilter has been removed with#15619, so related document has just been updated.

Test plan

cc@cpojer@SimenB

@netlify
Copy link

netlifybot commentedJun 13, 2025
edited
Loading

Deploy Preview forjestjs ready!

Builtwithout sensitive environment variables

NameLink
🔨 Latest commit37399db
🔍 Latest deploy loghttps://app.netlify.com/projects/jestjs/deploys/684c4470c16010000854f6ed
😎 Deploy Previewhttps://deploy-preview-15679--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify project configuration.

This comment was marked as outdated.

@pkg-pr-new
Copy link

pkg-pr-newbot commentedJun 13, 2025
edited
Loading

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@15679

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@15679

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@15679

create-jest

npm i https://pkg.pr.new/create-jest@15679

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@15679

expect

npm i https://pkg.pr.new/expect@15679

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@15679

jest

npm i https://pkg.pr.new/jest@15679

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@15679

jest-circus

npm i https://pkg.pr.new/jest-circus@15679

jest-cli

npm i https://pkg.pr.new/jest-cli@15679

jest-config

npm i https://pkg.pr.new/jest-config@15679

@jest/console

npm i https://pkg.pr.new/@jest/console@15679

@jest/core

npm i https://pkg.pr.new/@jest/core@15679

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@15679

jest-diff

npm i https://pkg.pr.new/jest-diff@15679

jest-docblock

npm i https://pkg.pr.new/jest-docblock@15679

jest-each

npm i https://pkg.pr.new/jest-each@15679

@jest/environment

npm i https://pkg.pr.new/@jest/environment@15679

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@15679

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@15679

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@15679

@jest/expect

npm i https://pkg.pr.new/@jest/expect@15679

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@15679

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@15679

@jest/globals

npm i https://pkg.pr.new/@jest/globals@15679

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@15679

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@15679

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@15679

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@15679

jest-message-util

npm i https://pkg.pr.new/jest-message-util@15679

jest-mock

npm i https://pkg.pr.new/jest-mock@15679

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@15679

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@15679

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@15679

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@15679

jest-resolve

npm i https://pkg.pr.new/jest-resolve@15679

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@15679

jest-runner

npm i https://pkg.pr.new/jest-runner@15679

jest-runtime

npm i https://pkg.pr.new/jest-runtime@15679

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@15679

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@15679

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@15679

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@15679

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@15679

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@15679

@jest/transform

npm i https://pkg.pr.new/@jest/transform@15679

@jest/types

npm i https://pkg.pr.new/@jest/types@15679

jest-util

npm i https://pkg.pr.new/jest-util@15679

jest-validate

npm i https://pkg.pr.new/jest-validate@15679

jest-watcher

npm i https://pkg.pr.new/jest-watcher@15679

jest-worker

npm i https://pkg.pr.new/jest-worker@15679

pretty-format

npm i https://pkg.pr.new/pretty-format@15679

commit:37399db

@JounQinJounQinforce-pushed thefeat/defaultAsyncResolver branch from7e1a758 to87874b1CompareJune 13, 2025 15:19
Copy link
Member

@SimenBSimenB left a comment

Choose a reason for hiding this comment

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

Nice!

Could you update the changelog as well?

@JounQin
Copy link
CollaboratorAuthor

JounQin commentedJun 13, 2025
edited
Loading

Could you update the changelog as well?

Done!


@SimenB CI is also passing now.

@JounQinJounQinforce-pushed thefeat/defaultAsyncResolver branch frombfd45e0 to47d9b5bCompareJune 13, 2025 15:24
@JounQinJounQin requested review fromSimenB andCopilotJune 14, 2025 02:33
Copy link

CopilotAI 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 adds and wires up an asynchronous version of Jest’s default module resolver across documentation, implementation, tests, snapshots, and the changelog.

  • IntroducesdefaultAsyncResolver API in the docs and types.
  • RefactorsdefaultResolver.ts to share logic between sync and async resolver paths.
  • UpdatesResolver class, tests, e2e snapshots, and the changelog to incorporate the new async resolver.

Reviewed Changes

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

Show a summary per file
FileDescription
website/versioned_docs/version-30.0/Configuration.mdDocumented the newdefaultAsyncResolver option
packages/jest-resolve/src/resolver.tsPasseddefaultAsyncResolver into sync/async flows
packages/jest-resolve/src/defaultResolver.tsExtracted common logic and exported async resolver
packages/jest-resolve/src/tests/resolve.test.tsImported and asserted presence of the new resolver
e2e/tests/*Updated stack-trace line numbers in snapshots
CHANGELOG.mdLogged the feature under[jest-resolver]
Comments suppressed due to low confidence (3)

packages/jest-resolve/src/defaultResolver.ts:97

  • Removing the absolute resolution ofbasedir may allow relative directories to slip through, potentially breaking resolution. Consider reintroducingbasedir = path.resolve(basedir); or validating thatoptions.basedir is always absolute.
// make sure that `basedir` is an absolute path

packages/jest-resolve/src/tests/resolve.test.ts:16

  • We should add direct tests fordefaultAsyncResolver to confirm it returns the same results asdefaultResolver when resolving valid paths and rejects on missing modules.
import defaultResolver, {defaultAsyncResolver} from '../defaultResolver';

website/versioned_docs/version-30.0/Configuration.md:1499

  • [nitpick] Consider adding a short code snippet showing how to calldefaultAsyncResolver within an async custom resolver, mirroring the example fordefaultResolver above.
Similarly, the `defaultAsyncResolver` is the default async resolver which takes the same arguments and returns a promise that resolves with a string or rejects with an error.

@cpojercpojer merged commit42c8e7d intojestjs:mainJun 14, 2025
76 checks passed
@JounQinJounQin deleted the feat/defaultAsyncResolver branchJune 14, 2025 13:38
});
};
```

Copy link
Contributor

Choose a reason for hiding this comment

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

There is another way to do similar with new resolver:

module.exports=(path,options)=>{// Call the defaultResolver, so we leverage its cache, error handling, etc.returnoptions.defaultResolver(path,{    ...options,// HACK!!!// this is option from unrs-resolver from https://github.com/unrs/unrs-resolver?tab=readme-ov-file#main-field// unrs-resolver used from jest-resolve now https://github.com/jestjs/jest/blob/v30.0.0/packages/jest-resolve/src/defaultResolver.ts#L84-L98// We use the fact that jest-resolve just pass extra options to resolvermainFields:["react-native","main"],});};

Copy link
Member

@SimenBSimenBJun 18, 2025
edited
Loading

Choose a reason for hiding this comment

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

that seems like a very reasonable way of doing it. should be added to the docs 😀

JounQin reacted with thumbs up emoji
Copy link
CollaboratorAuthor

@JounQinJounQinJun 18, 2025
edited
Loading

Choose a reason for hiding this comment

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

@vovkasm Would you like to raise a PR to add it?

@SimenB I'm thinking that we can expose more options fromunrs-resolver for exampletsconfig or we can also detecttsconfig.json orjsconfig.json automatically, so thatpaths/references will be supported out of box.

SimenB reacted with thumbs up emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

@JounQin I'd love to do it. Today or tomorrow!

JounQin reacted with heart emojiJounQin reacted with rocket emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

@JounQin see#15687

As for exposing options from unrs-resolver, it seems it is not necessary, interface ResolverOptions alreadyextends UpstreamResolveOptions.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend usingStackOverflow or ourdiscord channel for questions.

@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsJul 19, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

Copilot code reviewCopilotCopilot left review comments

@cpojercpojerAwaiting requested review from cpojer

@SimenBSimenBAwaiting requested review from SimenB

+1 more reviewer

@vovkasmvovkasmvovkasm left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@JounQin@vovkasm@SimenB@cpojer

[8]ページ先頭

©2009-2025 Movatter.jp