From 38f79321d0b550f9f689307443275ea0b6a8aae6 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 12 Feb 2024 09:44:22 +0100 Subject: [PATCH] docs: add team emeriti and update the sidebar and navigation (#5169) Co-authored-by: userquin --- docs/.vitepress/components/HomePage.vue | 11 +-- docs/.vitepress/config.ts | 44 ++++++++--- docs/.vitepress/contributors.ts | 24 +++--- docs/.vitepress/scripts/fetch-avatars.ts | 4 +- docs/.vitepress/style/main.css | 16 ++++ docs/config/file.md | 79 +++++++++++++++++++ docs/config/index.md | 97 ++++-------------------- docs/team.md | 36 +++++++++ 8 files changed, 195 insertions(+), 116 deletions(-) create mode 100644 docs/config/file.md create mode 100644 docs/team.md diff --git a/docs/.vitepress/components/HomePage.vue b/docs/.vitepress/components/HomePage.vue index 60fe81cfb..4feda3f2c 100644 --- a/docs/.vitepress/components/HomePage.vue +++ b/docs/.vitepress/components/HomePage.vue @@ -1,6 +1,5 @@ @@ -8,14 +7,6 @@ import { sponsors } from '../sponsors'
-
-

- Meet The Team -

-
- -
-
createLinks(tm)) +const teamEmeritiMembers = plainTeamEmeritiMembers.map(tm => createLinks(tm)) -export { teamMembers } +export { teamMembers, teamEmeritiMembers } diff --git a/docs/.vitepress/scripts/fetch-avatars.ts b/docs/.vitepress/scripts/fetch-avatars.ts index 59f8120dc..4587a12e7 100644 --- a/docs/.vitepress/scripts/fetch-avatars.ts +++ b/docs/.vitepress/scripts/fetch-avatars.ts @@ -1,7 +1,7 @@ import { existsSync, promises as fsp } from 'node:fs' import { fileURLToPath } from 'node:url' import { dirname, join, resolve } from 'pathe' -import { teamMembers } from '../contributors' +import { teamEmeritiMembers, teamMembers } from '../contributors' const docsDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..') const dirAvatars = resolve(docsDir, 'public/user-avatars/') @@ -23,7 +23,7 @@ async function fetchAvatars() { if (!existsSync(dirAvatars)) await fsp.mkdir(dirAvatars, { recursive: true }) - await Promise.all(teamMembers.map(c => c.github).map(name => download(`https://github.com/${name}.png?size=100`, join(dirAvatars, `${name}.png`)))) + await Promise.all([...teamEmeritiMembers, ...teamMembers].map(c => c.github).map(name => download(`https://github.com/${name}.png?size=100`, join(dirAvatars, `${name}.png`)))) } async function fetchSponsors() { diff --git a/docs/.vitepress/style/main.css b/docs/.vitepress/style/main.css index 7b57691c6..87c08069f 100644 --- a/docs/.vitepress/style/main.css +++ b/docs/.vitepress/style/main.css @@ -106,6 +106,22 @@ img.resizable-img { height: unset; } +.VPTeamMembersItem.medium .profile .data .affiliation { + min-height: unset; +} +.VPTeamMembersItem.medium .profile .data .desc { + min-height: unset; +} +/* fix height ~ 2 lines of text: 3 cards per row */ +@media (min-width: 648px) { + .VPTeamMembersItem.medium .profile .data .affiliation { + min-height: 4rem; + } + .VPTeamMembersItem.medium .profile .data .desc { + min-height: 4rem; + } +} + /* fix height ~ 2 lines of text: 3 or more cards per row */ .VPTeamMembersItem.small .profile .data .affiliation { min-height: 3rem; diff --git a/docs/config/file.md b/docs/config/file.md new file mode 100644 index 000000000..c92899ce0 --- /dev/null +++ b/docs/config/file.md @@ -0,0 +1,79 @@ +--- +outline: deep +--- + +# Managing Vitest config file + +If you are using Vite and have a `vite.config` file, Vitest will read it to match with the plugins and setup as your Vite app. If you want to have a different configuration for testing or your main app doesn't rely on Vite specifically, you could either: + +- Create `vitest.config.ts`, which will have the higher priority and will **override** the configuration from `vite.config.ts` (Vitest supports all conventional JS and TS extensions, but doesn't support `json`) - it means all options in your `vite.config` will be **ignored** +- Pass `--config` option to CLI, e.g. `vitest --config ./path/to/vitest.config.ts` +- Use `process.env.VITEST` or `mode` property on `defineConfig` (will be set to `test`/`benchmark` if not overridden with `--mode`) to conditionally apply different configuration in `vite.config.ts` + +To configure `vitest` itself, add `test` property in your Vite config. You'll also need to add a reference to Vitest types using a [triple slash command](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-) at the top of your config file, if you are importing `defineConfig` from `vite` itself. + +Using `defineConfig` from `vite` you should follow this: + +```ts +/// +import { defineConfig } from 'vite' + +export default defineConfig({ + test: { + // ... Specify options here. + }, +}) +``` + +Using `defineConfig` from `vitest/config` you should follow this: + +```ts +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + // ... Specify options here. + }, +}) +``` + +You can retrieve Vitest's default options to expand them if needed: + +```ts +import { configDefaults, defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + exclude: [...configDefaults.exclude, 'packages/template/*'], + }, +}) +``` + +When using a separate `vitest.config.js`, you can also extend Vite's options from another config file if needed: + +```ts +import { defineConfig, mergeConfig } from 'vitest/config' +import viteConfig from './vite.config' + +export default mergeConfig(viteConfig, defineConfig({ + test: { + exclude: ['packages/template/*'], + }, +})) +``` + +If your Vite config is defined as a function, you can define the config like this: + +```ts +import { defineConfig, mergeConfig } from 'vitest/config' +import viteConfig from './vite.config' + +export default defineConfig(configEnv => mergeConfig( + viteConfig(configEnv), + defineConfig({ + test: { + exclude: ['packages/template/*'], + }, + }) +)) +``` diff --git a/docs/config/index.md b/docs/config/index.md index 47910be20..5fa28b36b 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -4,90 +4,9 @@ outline: deep # Configuring Vitest -## Configuration - -`vitest` will read your root `vite.config.ts` when it is present to match with the plugins and setup as your Vite app. If you want to have a different configuration for testing or your main app doesn't rely on Vite specifically, you could either: - -- Create `vitest.config.ts`, which will have the higher priority and will override the configuration from `vite.config.ts` -- Pass `--config` option to CLI, e.g. `vitest --config ./path/to/vitest.config.ts` -- Use `process.env.VITEST` or `mode` property on `defineConfig` (will be set to `test`/`benchmark` if not overridden) to conditionally apply different configuration in `vite.config.ts` - -To configure `vitest` itself, add `test` property in your Vite config. You'll also need to add a reference to Vitest types using a [triple slash command](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types-) at the top of your config file, if you are importing `defineConfig` from `vite` itself. - -Using `defineConfig` from `vite` you should follow this: - -```ts -/// -import { defineConfig } from 'vite' - -export default defineConfig({ - test: { - // ... Specify options here. - }, -}) -``` - -Using `defineConfig` from `vitest/config` you should follow this: - -```ts -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - // ... Specify options here. - }, -}) -``` - -You can retrieve Vitest's default options to expand them if needed: - -```ts -import { configDefaults, defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - exclude: [...configDefaults.exclude, 'packages/template/*'], - }, -}) -``` - -When using a separate `vitest.config.js`, you can also extend Vite's options from another config file if needed: - -```ts -import { defineConfig, mergeConfig } from 'vitest/config' -import viteConfig from './vite.config' - -export default mergeConfig(viteConfig, defineConfig({ - test: { - exclude: ['packages/template/*'], - }, -})) -``` +To create a Vitest configuration file, follow [the guide](/config/file). Make sure you understand how Vitest config resolution works before proceeding. ::: warning -`mergeConfig` helper is available in Vitest since v0.30.0. You can import it from `vite` directly, if you use lower version. -::: - -If your Vite config is defined as a function, you can define the config like this: -```ts -import { defineConfig, mergeConfig } from 'vitest/config' -import viteConfig from './vite.config' - -export default defineConfig(configEnv => mergeConfig( - viteConfig(configEnv), - defineConfig({ - test: { - exclude: ['packages/template/*'], - }, - }) -)) -``` - -## Options - -:::tip -In addition to the following options, you can also use any configuration option from [Vite](https://vitejs.dev/config/). For example, `define` to define global variables, or `resolve.alias` to define aliases. - _All_ listed options here are located on a `test` property inside the config: ```ts @@ -100,6 +19,8 @@ export default defineConfig({ ::: ::: tip +In addition to the following options, you can also use any configuration option from [Vite](https://vitejs.dev/config/). For example, `define` to define global variables, or `resolve.alias` to define aliases. + All configuration options that are not supported inside a [workspace](/guide/workspace) project config have sign next to them. ::: @@ -107,15 +28,23 @@ All configuration options that are not supported inside a [workspace](/guide/wor - **Type:** `string[]` - **Default:** `['**/*.{test,spec}.?(c|m)[jt]s?(x)']` +- **CLI:** `vitest [...include]`, `vitest **/*.test.js` -Files to include in the test run, using glob pattern. +A list of glob patterns that match your test files. ### exclude - **Type:** `string[]` - **Default:** `['**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**', '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*']` +- **CLI:** `vitest --exclude "**/excluded-file"` + +A list of glob patterns that should be excluded from your test files. -Files to exclude from the test run, using glob pattern. +::: warning +This option does not affect coverage. If you need to remove certain files from the coverage report, use [`coverage.exclude`](#coverage-exclude). + +This is the only option that doesn't override your configuration if you provide it with a CLI flag. All glob patterns added via `--exclude` flag will be added to the config's `exclude`. +::: ### includeSource diff --git a/docs/team.md b/docs/team.md new file mode 100644 index 000000000..10e517148 --- /dev/null +++ b/docs/team.md @@ -0,0 +1,36 @@ +--- +layout: page +title: Meet the Team +description: The development of Vitest is guided by an international team. +--- + + + + + + + + + + + + + + + -- 2.51.2