Skip to content

Commit 26c4a78

Browse files
committed
docs(en): merging all conflicts
2 parents 86c42c8 + b017fcf commit 26c4a78

21 files changed

+2434
-42
lines changed

.vitepress/config.ts

+183
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,189 @@ export default withPwa(
286286
},
287287
],
288288
},
289+
<<<<<<< HEAD
290+
=======
291+
{
292+
text: `v${version}`,
293+
link: `https://github.com/vitest-dev/vitest/releases/tag/v${version}`,
294+
},
295+
],
296+
297+
sidebar: {
298+
// TODO: bring sidebar of apis and config back
299+
'/advanced': [
300+
{
301+
items: [
302+
{
303+
text: 'Vitest Node API',
304+
link: '/advanced/api',
305+
},
306+
{
307+
text: 'Runner API',
308+
link: '/advanced/runner',
309+
},
310+
{
311+
text: 'Task Metadata',
312+
link: '/advanced/metadata',
313+
},
314+
{
315+
text: 'Extending Reporters',
316+
link: '/advanced/reporters',
317+
},
318+
{
319+
text: 'Custom Pool',
320+
link: '/advanced/pool',
321+
},
322+
],
323+
},
324+
],
325+
'/guide/': [
326+
{
327+
items: [
328+
{
329+
text: 'Why Vitest',
330+
link: '/guide/why',
331+
},
332+
{
333+
text: 'Getting Started',
334+
link: '/guide/',
335+
},
336+
{
337+
text: 'Features',
338+
link: '/guide/features',
339+
},
340+
{
341+
text: 'Workspace',
342+
link: '/guide/workspace',
343+
},
344+
{
345+
text: 'CLI',
346+
link: '/guide/cli',
347+
},
348+
{
349+
text: 'Test Filtering',
350+
link: '/guide/filtering',
351+
},
352+
{
353+
text: 'Reporters',
354+
link: '/guide/reporters',
355+
},
356+
{
357+
text: 'Coverage',
358+
link: '/guide/coverage',
359+
},
360+
{
361+
text: 'Snapshot',
362+
link: '/guide/snapshot',
363+
},
364+
{
365+
text: 'Mocking',
366+
link: '/guide/mocking',
367+
},
368+
{
369+
text: 'Testing Types',
370+
link: '/guide/testing-types',
371+
},
372+
{
373+
text: 'Vitest UI',
374+
link: '/guide/ui',
375+
},
376+
{
377+
text: 'Browser Mode',
378+
link: '/guide/browser',
379+
},
380+
{
381+
text: 'In-Source Testing',
382+
link: '/guide/in-source',
383+
},
384+
{
385+
text: 'Test Context',
386+
link: '/guide/test-context',
387+
},
388+
{
389+
text: 'Environment',
390+
link: '/guide/environment',
391+
},
392+
{
393+
text: 'Extending Matchers',
394+
link: '/guide/extending-matchers',
395+
},
396+
{
397+
text: 'IDE Integration',
398+
link: '/guide/ide',
399+
},
400+
{
401+
text: 'Debugging',
402+
link: '/guide/debugging',
403+
},
404+
{
405+
text: 'Comparisons',
406+
link: '/guide/comparisons',
407+
},
408+
{
409+
text: 'Migration Guide',
410+
link: '/guide/migration',
411+
},
412+
{
413+
text: 'Common Errors',
414+
link: '/guide/common-errors',
415+
},
416+
{
417+
text: 'Improving Performance',
418+
link: '/guide/improving-performance',
419+
},
420+
],
421+
},
422+
],
423+
'/api/': [
424+
{
425+
items: [
426+
{
427+
text: 'Test API Reference',
428+
link: '/api/',
429+
},
430+
{
431+
text: 'Mock Functions',
432+
link: '/api/mock',
433+
},
434+
{
435+
text: 'Vi Utility',
436+
link: '/api/vi',
437+
},
438+
{
439+
text: 'Expect',
440+
link: '/api/expect',
441+
},
442+
{
443+
text: 'ExpectTypeOf',
444+
link: '/api/expect-typeof',
445+
},
446+
{
447+
text: 'Assert',
448+
link: '/api/assert',
449+
},
450+
{
451+
text: 'AssertType',
452+
link: '/api/assert-type',
453+
},
454+
],
455+
},
456+
],
457+
'/config/': [
458+
{
459+
items: [
460+
{
461+
text: 'Config File',
462+
link: '/config/file',
463+
},
464+
{
465+
text: 'Config Reference',
466+
link: '/config/',
467+
},
468+
],
469+
},
470+
],
471+
>>>>>>> b017fcf5511078b058f902eae0469535dfe8392b
289472
},
290473
pwa,
291474
transformHead,

advanced/api.md

+10
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ const vitest = await createVitest('test', {
4646
})
4747
```
4848
49+
## parseCLI
50+
51+
You can use this method to parse CLI arguments. It accepts a string (where arguments are split by a single space) or a strings array of CLI arguments in the same format that Vitest CLI uses. It returns a filter and `options` that you can later pass down to `createVitest` or `startVitest` methods.
52+
53+
```ts
54+
import { parseCLI } from 'vitest/node'
55+
56+
parseCLI('vitest ./files.ts --coverage --browser=chrome')
57+
```
58+
4959
## Vitest
5060
5161
Vitest 实例需要当前的测试模式。它可以是以下之一:

advanced/pool.md

+4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ export interface ProcessPool {
5050

5151
这个函数只会被调用一次(除非服务器配置被更新),通常最好在这个函数内初始化测试所需的一切,并在调用 `runTests` 时重复使用它。
5252

53+
<<<<<<< HEAD
5354
Vitest 在安排运行新测试时调用 `runTest`。如果 `files` 为空,将不会调用它。第一个参数是一个元组数组:第一个元素是对工作区项目的引用,第二个元素是测试文件的绝对路径。在调用 `runTests` 之前,文件将使用 [`sequencer`](/config/#sequence.sequencer) 进行排序。可能(但不太可能)会有相同的文件出现两次,但它们将始终属于不同的项目 - 这是通过 [`vitest.workspace.ts`](/guide/workspace) 配置实现的。
55+
=======
56+
Vitest calls `runTest` when new tests are scheduled to run. It will not call it if `files` is empty. The first argument is an array of tuples: the first element is a reference to a workspace project and the second one is an absolute path to a test file. Files are sorted using [`sequencer`](/config/#sequence-sequencer) before `runTests` is called. It's possible (but unlikely) to have the same file twice, but it will always have a different project - this is implemented via [`vitest.workspace.ts`](/guide/workspace) configuration.
57+
>>>>>>> b017fcf5511078b058f902eae0469535dfe8392b
5458
5559
Vitest 会等到 `runTests` 执行完毕后才结束运行(即只有在 `runTests` 解决后才会触发 [`onFinished`](/guide/reporters))。
5660

0 commit comments

Comments
 (0)