Skip to content

Commit

Permalink
docs: link the regular guide from the advanced page (#6602)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Oct 1, 2024
1 parent 3de00ab commit 7e26235
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/advanced/pool.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Custom Pool

::: warning
This is advanced API. If you are just running tests, you probably don't need this. It is primarily used by library authors.
This is advanced API. If you just want to [run tests](/guide/), you probably don't need this. It is primarily used by library authors.
:::

Vitest runs tests in pools. By default, there are several pools:
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/runner.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Test Runner

::: warning
This is advanced API. If you are just running tests, you probably don't need this. It is primarily used by library authors.
This is advanced API. If you just want to [run tests](/guide/), you probably don't need this. It is primarily used by library authors.
:::

You can specify a path to your test runner with the `runner` option in your configuration file. This file should have a default export with a class constructor implementing these methods:
Expand Down
6 changes: 5 additions & 1 deletion docs/guide/in-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ title: In-Source Testing | Guide

# In-Source Testing

Vitest also provides a way to run tests within your source code along side the implementation, similar to [Rust's module tests](https://doc.rust-lang.org/book/ch11-03-test-organization.html#the-tests-module-and-cfgtest).
Vitest provides a way to run tests within your source code along side the implementation, similar to [Rust's module tests](https://doc.rust-lang.org/book/ch11-03-test-organization.html#the-tests-module-and-cfgtest).

This makes the tests share the same closure as the implementations and able to test against private states without exporting. Meanwhile, it also brings a closer feedback loop for development.

::: warning
This guide explains how to write tests inside your source code. If you need to write tests in separate test files, follow the ["Writing Tests" guide](/guide/#writing-tests).
:::

## Setup

To get started, put a `if (import.meta.vitest)` block at the end of your source file and write some tests inside it. For example:
Expand Down

0 comments on commit 7e26235

Please sign in to comment.