Skip to content

Commit

Permalink
docs: update workspace docs (#3157)
Browse files Browse the repository at this point in the history
  • Loading branch information
dammy001 committed Apr 12, 2023
1 parent aa22f79 commit b81ffd9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/config/index.md
Expand Up @@ -75,7 +75,7 @@ In addition to the following options, you can also use any configuration option
:::

::: tip
All configuration options that are not supported inside a [workspace](/guide/workspace) project config have <NonProjectOption /> sign next them.
All configuration options that are not supported inside a [workspace](/guide/workspace) project config have <NonProjectOption /> sign next to them.
:::

### include
Expand Down Expand Up @@ -105,7 +105,7 @@ Handling for dependencies resolution.
- **See also:** [Dep Optimization Options](https://vitejs.dev/config/dep-optimization-options.html)

::: warning
This feature is temporary disabled since Vitest 0.30.0.
This feature is temporarily disabled since Vitest 0.30.0.
:::

Enable dependency optimization. If you have a lot of tests, this might improve their performance.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Expand Up @@ -63,7 +63,7 @@ See the list of config options in the [Config Reference](../config/)

## Workspaces Support

Run different project configurations inside the same project with [Vitest Workspaces](/guide/workspace). You can define a list of files and folders that define you workspace in `vitest.workspace` file. The file supports `js`/`ts`/`json` extensions. This feature works great with monorepo setups.
Run different project configurations inside the same project with [Vitest Workspaces](/guide/workspace). You can define a list of files and folders that define your workspace in `vitest.workspace` file. The file supports `js`/`ts`/`json` extensions. This feature works great with monorepo setups.

```ts
import { defineWorkspace } from 'vitest/config'
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/workspace.md
Expand Up @@ -4,7 +4,7 @@ Vitest provides built-in support for monorepositories through a workspace config

## Defining a workspace

A workspace should have a `vitest.workspace` or `vitest.projects` file in its root (in the same folder with your config file, if you have one). Vitest supports `ts`/`js`/`json` extensions for this file.
A workspace should have a `vitest.workspace` or `vitest.projects` file in its root (in the same folder as your config file if you have one). Vitest supports `ts`/`js`/`json` extensions for this file.

Workspace configuration file should have a default export with a list of files or glob patterns referencing your projects. For example, if you have a folder with your projects named `packages`, you can define a workspace with this config file:

Expand Down Expand Up @@ -69,7 +69,7 @@ export default defineWorkspace([
:::

::: warning
All projects should have unique names. Otherwise Vitest will throw an error. If you do not provide a name inside inline config, Vitest will assign a number. If you don't provide a name inside a project config defined with glob syntax, Vitest will use the directory name by default.
All projects should have unique names. Otherwise, Vitest will throw an error. If you do not provide a name inside the inline config, Vitest will assign a number. If you don't provide a name inside a project config defined with glob syntax, Vitest will use the directory name by default.
:::

If you don't rely on inline configs, you can just create a small json file in your root directory:
Expand Down Expand Up @@ -119,7 +119,7 @@ export default mergeConfig(
```
:::

Also some of the configuration options are not allowed in a project config. Most notably:
Also, some of the configuration options are not allowed in a project config. Most notably:

- `coverage`: coverage is done for the whole workspace
- `reporters`: only root-level reporters can be supported
Expand All @@ -132,6 +132,6 @@ All configuration options that are not supported inside a project config have <N

## Coverage

Coverage for workspace projects works out of the box. But if you have [`all`](/config/#coverage-all) option enabled and use non-conventional extensions in some of you projects, you will need to have a plugin that handles this extension in your root configuration file.
Coverage for workspace projects works out of the box. But if you have [`all`](/config/#coverage-all) option enabled and use non-conventional extensions in some of your projects, you will need to have a plugin that handles this extension in your root configuration file.

For example, if you have a package that uses Vue files and it has its own config file, but some of the files are not imported in your tests, coverage will fail trying to analyze the usage of unused files, because it relies on the root configuration rather than project configuration.

0 comments on commit b81ffd9

Please sign in to comment.