Skip to content

Commit 9a1b501

Browse files
authored
feat: prepare the Vitest API to be stable (#6962)
1 parent 100230e commit 9a1b501

File tree

100 files changed

+3512
-1585
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3512
-1585
lines changed

docs/.vitepress/config.ts

+83-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
2+
import { transformerNotationWordHighlight } from '@shikijs/transformers'
23
import { withPwa } from '@vite-pwa/vitepress'
34
import type { DefaultTheme } from 'vitepress'
45
import { defineConfig } from 'vitepress'
@@ -87,8 +88,9 @@ export default ({ mode }: { mode: string }) => {
8788
dark: 'github-dark',
8889
},
8990
codeTransformers: mode === 'development'
90-
? []
91+
? [transformerNotationWordHighlight()]
9192
: [
93+
transformerNotationWordHighlight(),
9294
transformerTwoslash({
9395
processHoverInfo: (info) => {
9496
if (info.includes(process.cwd())) {
@@ -146,7 +148,7 @@ export default ({ mode }: { mode: string }) => {
146148
items: [
147149
{
148150
text: 'Advanced API',
149-
link: '/advanced/api',
151+
link: '/advanced/api/',
150152
activeMatch: '^/advanced/',
151153
},
152154
{
@@ -243,16 +245,62 @@ export default ({ mode }: { mode: string }) => {
243245
},
244246
],
245247
},
246-
footer(),
248+
{
249+
items: [
250+
...footer(),
251+
{
252+
text: 'Node API Reference',
253+
link: '/advanced/api/',
254+
},
255+
],
256+
},
247257
],
248258
'/advanced': [
249259
{
250260
text: 'API',
251261
collapsed: false,
252262
items: [
253263
{
254-
text: 'Vitest Node API',
255-
link: '/advanced/api',
264+
text: 'Node API',
265+
items: [
266+
{
267+
text: 'Getting Started',
268+
link: '/advanced/api/',
269+
},
270+
{
271+
text: 'Vitest',
272+
link: '/advanced/api/vitest',
273+
},
274+
{
275+
text: 'TestProject',
276+
link: '/advanced/api/test-project',
277+
},
278+
{
279+
text: 'TestSpecification',
280+
link: '/advanced/api/test-specification',
281+
},
282+
],
283+
},
284+
{
285+
text: 'Test Task API',
286+
items: [
287+
{
288+
text: 'TestCase',
289+
link: '/advanced/api/test-case',
290+
},
291+
{
292+
text: 'TestSuite',
293+
link: '/advanced/api/test-suite',
294+
},
295+
{
296+
text: 'TestModule',
297+
link: '/advanced/api/test-module',
298+
},
299+
{
300+
text: 'TestCollection',
301+
link: '/advanced/api/test-collection',
302+
},
303+
],
256304
},
257305
{
258306
text: 'Runner API',
@@ -282,7 +330,9 @@ export default ({ mode }: { mode: string }) => {
282330
},
283331
],
284332
},
285-
footer(),
333+
{
334+
items: footer(),
335+
},
286336
],
287337
'/team': [],
288338
'/': [
@@ -308,7 +358,7 @@ export default ({ mode }: { mode: string }) => {
308358
link: '/guide/browser',
309359
},
310360
{
311-
text: 'Advanced API',
361+
text: 'Node API Reference',
312362
link: '/advanced/api',
313363
},
314364
{
@@ -325,19 +375,17 @@ export default ({ mode }: { mode: string }) => {
325375
}))
326376
}
327377

328-
function footer(): DefaultTheme.SidebarItem {
329-
return {
330-
items: [
331-
{
332-
text: 'Config Reference',
333-
link: '/config/',
334-
},
335-
{
336-
text: 'Test API Reference',
337-
link: '/api/',
338-
},
339-
],
340-
}
378+
function footer(): DefaultTheme.SidebarItem[] {
379+
return [
380+
{
381+
text: 'Config Reference',
382+
link: '/config/',
383+
},
384+
{
385+
text: 'Test API Reference',
386+
link: '/api/',
387+
},
388+
]
341389
}
342390

343391
function introduction(): DefaultTheme.SidebarItem[] {
@@ -423,14 +471,25 @@ function guide(): DefaultTheme.SidebarItem[] {
423471
text: 'Debugging',
424472
link: '/guide/debugging',
425473
},
426-
{
427-
text: 'Migration Guide',
428-
link: '/guide/migration',
429-
},
430474
{
431475
text: 'Common Errors',
432476
link: '/guide/common-errors',
433477
},
478+
{
479+
text: 'Migration Guide',
480+
link: '/guide/migration',
481+
collapsed: false,
482+
items: [
483+
{
484+
text: 'Migrating to Vitest 3.0',
485+
link: '/guide/migration#vitest-3',
486+
},
487+
{
488+
text: 'Migrating from Jest',
489+
link: '/guide/migration#jest',
490+
},
491+
],
492+
},
434493
{
435494
text: 'Performance',
436495
collapsed: false,

docs/.vitepress/style/main.css

+6
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,9 @@ img.resizable-img {
170170
min-height: unset;
171171
}
172172
}
173+
174+
.highlighted-word {
175+
background-color: var(--vp-code-line-highlight-color);
176+
transition: background-color 0.5s;
177+
display: inline-block;
178+
}

0 commit comments

Comments
 (0)