Skip to content

docs(cn): update /config file#947

Draft
NoiseFan wants to merge 19 commits intovitest-dev:devfrom
NoiseFan:docs/config
Draft

docs(cn): update /config file#947
NoiseFan wants to merge 19 commits intovitest-dev:devfrom
NoiseFan:docs/config

Conversation

@NoiseFan
Copy link
Copy Markdown
Collaborator

在提交PR之前,请确保您执行以下操作:

  • 曾阅读过翻译须知
  • 检查是否已经有PR以同样的方式解决问题,以避免创建重复。
  • 在此PR中描述正在解决的问题,或引用它解决的问题(例如:fixes #123)。

描述

附加上下文

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 23, 2026

Deploy Preview for cn-vitest ready!

Name Link
🔨 Latest commit aeecc32
🔍 Latest deploy log https://app.netlify.com/projects/cn-vitest/deploys/69c6234de8a1a10008056b9b
😎 Deploy Preview https://deploy-preview-947--cn-vitest.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 your Netlify project configuration.

@thinkasany
Copy link
Copy Markdown
Collaborator

@codex

Copy link
Copy Markdown

@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: 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` 属性的对象:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 环境中导入此类依赖项时,你将看到以下错误:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

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