Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions api/advanced/reporters-life-cycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!-- 因经常误被错误格式化,故另抽单个文件处理-->

- [`onInit`](#oninit)
- [`onTestRunStart`](#ontestrunstart)
- [`onTestModuleQueued`](#ontestmodulequeued)
- [`onTestModuleCollected`](#ontestmodulecollected)
- [`onTestModuleStart`](#ontestmodulestart)
- [`onTestSuiteReady`](#ontestsuiteready)
- [`onHookStart(beforeAll)`](#onhookstart)
- [`onHookEnd(beforeAll)`](#onhookend)
- [`onTestCaseReady`](#ontestcaseready)
- [`onTestCaseAnnotate`](#ontestcaseannotate) <Version>3.2.0</Version>
- [`onTestCaseArtifactRecord`](#ontestcaseartifactrecord) <Version type="experimental">4.0.11</Version>
- [`onHookStart(beforeEach)`](#onhookstart)
- [`onHookEnd(beforeEach)`](#onhookend)
- [`onHookStart(afterEach)`](#onhookstart)
- [`onHookEnd(afterEach)`](#onhookend)
- [`onTestCaseResult`](#ontestcaseresult)
- [`onHookStart(afterAll)`](#onhookstart)
- [`onHookEnd(afterAll)`](#onhookend)
- [`onTestSuiteResult`](#ontestsuiteresult)
- [`onTestModuleEnd`](#ontestmoduleend)
- [`onCoverage`](#oncoverage)
- [`onTestRunEnd`](#ontestrunend)
19 changes: 1 addition & 18 deletions api/advanced/reporters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,7 @@

Vitest 拥有自己的测试运行生命周期。这些生命周期通过报告器的方法来表示:

- [报告器 {#reporters}](#报告器-reporters)
- [onInit](#oninit)
- [onBrowserInit {#onbrowserinit}](#onbrowserinit-onbrowserinit)
- [onTestRunStart](#ontestrunstart)
- [onTestRunEnd](#ontestrunend)
- [onCoverage](#oncoverage)
- [onTestModuleQueued](#ontestmodulequeued)
- [onTestModuleCollected](#ontestmodulecollected)
- [onTestModuleStart](#ontestmodulestart)
- [onTestModuleEnd](#ontestmoduleend)
- [onHookStart](#onhookstart)
- [onHookEnd](#onhookend)
- [onTestSuiteReady](#ontestsuiteready)
- [onTestSuiteResult](#ontestsuiteresult)
- [onTestCaseReady](#ontestcaseready)
- [onTestCaseResult](#ontestcaseresult)
- [onTestCaseAnnotate 3.2.0 {#ontestcaseannotate}](#ontestcaseannotate-320-ontestcaseannotate)
- [onTestCaseArtifactRecord 4.0.11 {#ontestcaseartifactrecord}](#ontestcaseartifactrecord-4011-ontestcaseartifactrecord)
<!--@include: ./reporters-life-cycle.md-->

除非被跳过,否则单个模块中的测试和 reporters 将按顺序报告。所有跳过的测试将在 reporters 测试套件或模块的末尾报告。

Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default antfu(
'advanced/api/import-example.md',
'api/advanced/import-example.md',
'guide/examples/*.md',
'reporters-life-cycle.md',

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 Use an ignore glob that reaches the partial

In this flat ESLint setup, a bare reporters-life-cycle.md pattern only matches a file at the config root, while the newly added partial is api/advanced/reporters-life-cycle.md. As a result, CI/pre-commit runs such as eslint . or lint-staged on that staged file will still lint/format the partial, which defeats the purpose of moving the fragile lifecycle list out of reporters.md; use the actual relative path or **/reporters-life-cycle.md instead.

Useful? React with 👍 / 👎.

'README.md',
'.github/*.md',
],
Expand Down
Loading