Conversation
✅ Deploy Preview for cn-vitest ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0127ac00c
ℹ️ 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".
| 你还可以定义自定义环境。使用非内置环境时,Vitest 会根据你提供的内容加载对应的文件或包:如果是文件路径则加载文件,如果是包名则加载 `vitest-environment-${name}` 的包 | ||
|
|
||
| The custom environment file should export an object with the shape of `Environment`: | ||
| 该包应导出一个具有 `Environment` 属性的对象: |
There was a problem hiding this comment.
Fix custom environment export description
This sentence says the custom environment package should export an object that has an Environment property, but Vitest expects the default export itself to conform to the Environment shape. Following the current wording can lead readers to build the wrong object structure and have their custom environment fail to load correctly.
Useful? React with 👍 / 👎.
| - **默认值:** `true` | ||
|
|
||
| Interpret CJS module's default as named exports. Some dependencies only bundle CJS modules and don't use named exports that Node.js can statically analyze when a package is imported using `import` syntax instead of `require`. When importing such dependencies in Node environment using named exports, you will see this error: | ||
| 将 CJS 模块的默认值视为命名导出。某些依赖项仅捆绑 CJS 模块,不使用命名导出,Node.js 可以在使用 `import` 语法而不是 `require` 导入包时对其进行静态分析。使用命名导出在 Node 环境中导入此类依赖项时,你将看到以下错误: |
There was a problem hiding this comment.
Correct CJS named-export static analysis statement
The translation currently states that Node.js can statically analyze these CJS named exports, which is the opposite of the behavior being explained in this section. This inversion is misleading for users configuring deps.interopDefault, because it suggests named imports from CJS should work when they typically trigger the runtime errors shown below.
Useful? React with 👍 / 👎.
在提交PR之前,请确保您执行以下操作:
fixes #123)。描述
附加上下文