diff --git a/docs/advanced/pool.md b/docs/advanced/pool.md index 2d5309be44ce..d2ab9f145924 100644 --- a/docs/advanced/pool.md +++ b/docs/advanced/pool.md @@ -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: diff --git a/docs/advanced/runner.md b/docs/advanced/runner.md index d4bf8fecc3ff..6007fde87de3 100644 --- a/docs/advanced/runner.md +++ b/docs/advanced/runner.md @@ -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: diff --git a/docs/guide/in-source.md b/docs/guide/in-source.md index 4a43c6423ef1..29822f177841 100644 --- a/docs/guide/in-source.md +++ b/docs/guide/in-source.md @@ -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: