Skip to content

Commit

Permalink
feat: prepare the Vitest API to be stable (#6962)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Dec 10, 2024
1 parent 100230e commit 9a1b501
Show file tree
Hide file tree
Showing 100 changed files with 3,512 additions and 1,585 deletions.
107 changes: 83 additions & 24 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { transformerNotationWordHighlight } from '@shikijs/transformers'
import { withPwa } from '@vite-pwa/vitepress'
import type { DefaultTheme } from 'vitepress'
import { defineConfig } from 'vitepress'
Expand Down Expand Up @@ -87,8 +88,9 @@ export default ({ mode }: { mode: string }) => {
dark: 'github-dark',
},
codeTransformers: mode === 'development'
? []
? [transformerNotationWordHighlight()]
: [
transformerNotationWordHighlight(),
transformerTwoslash({
processHoverInfo: (info) => {
if (info.includes(process.cwd())) {
Expand Down Expand Up @@ -146,7 +148,7 @@ export default ({ mode }: { mode: string }) => {
items: [
{
text: 'Advanced API',
link: '/advanced/api',
link: '/advanced/api/',
activeMatch: '^/advanced/',
},
{
Expand Down Expand Up @@ -243,16 +245,62 @@ export default ({ mode }: { mode: string }) => {
},
],
},
footer(),
{
items: [
...footer(),
{
text: 'Node API Reference',
link: '/advanced/api/',
},
],
},
],
'/advanced': [
{
text: 'API',
collapsed: false,
items: [
{
text: 'Vitest Node API',
link: '/advanced/api',
text: 'Node API',
items: [
{
text: 'Getting Started',
link: '/advanced/api/',
},
{
text: 'Vitest',
link: '/advanced/api/vitest',
},
{
text: 'TestProject',
link: '/advanced/api/test-project',
},
{
text: 'TestSpecification',
link: '/advanced/api/test-specification',
},
],
},
{
text: 'Test Task API',
items: [
{
text: 'TestCase',
link: '/advanced/api/test-case',
},
{
text: 'TestSuite',
link: '/advanced/api/test-suite',
},
{
text: 'TestModule',
link: '/advanced/api/test-module',
},
{
text: 'TestCollection',
link: '/advanced/api/test-collection',
},
],
},
{
text: 'Runner API',
Expand Down Expand Up @@ -282,7 +330,9 @@ export default ({ mode }: { mode: string }) => {
},
],
},
footer(),
{
items: footer(),
},
],
'/team': [],
'/': [
Expand All @@ -308,7 +358,7 @@ export default ({ mode }: { mode: string }) => {
link: '/guide/browser',
},
{
text: 'Advanced API',
text: 'Node API Reference',
link: '/advanced/api',
},
{
Expand All @@ -325,19 +375,17 @@ export default ({ mode }: { mode: string }) => {
}))
}

function footer(): DefaultTheme.SidebarItem {
return {
items: [
{
text: 'Config Reference',
link: '/config/',
},
{
text: 'Test API Reference',
link: '/api/',
},
],
}
function footer(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Config Reference',
link: '/config/',
},
{
text: 'Test API Reference',
link: '/api/',
},
]
}

function introduction(): DefaultTheme.SidebarItem[] {
Expand Down Expand Up @@ -423,14 +471,25 @@ function guide(): DefaultTheme.SidebarItem[] {
text: 'Debugging',
link: '/guide/debugging',
},
{
text: 'Migration Guide',
link: '/guide/migration',
},
{
text: 'Common Errors',
link: '/guide/common-errors',
},
{
text: 'Migration Guide',
link: '/guide/migration',
collapsed: false,
items: [
{
text: 'Migrating to Vitest 3.0',
link: '/guide/migration#vitest-3',
},
{
text: 'Migrating from Jest',
link: '/guide/migration#jest',
},
],
},
{
text: 'Performance',
collapsed: false,
Expand Down
6 changes: 6 additions & 0 deletions docs/.vitepress/style/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,9 @@ img.resizable-img {
min-height: unset;
}
}

.highlighted-word {
background-color: var(--vp-code-line-highlight-color);
transition: background-color 0.5s;
display: inline-block;
}
Loading

0 comments on commit 9a1b501

Please sign in to comment.