Skip to content

Commit 0018e4f

Browse files
docs: update global Nitro app tips
1 parent cc0cf1b commit 0018e4f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ yarn add -D nitro-test-utils vitest
3131
There are two ways to set up the Nitro test environment: globally or per test suite. The global setup is useful if you want to test multiple test files against the same Nitro server. The per test suite setup is useful if you want to test different Nitro servers in different test files.
3232

3333
> [!TIP]
34-
> The global setup is recommended for most use cases, as it keeps the Nitro development server running in the background in Vitest watch mode. This allows you to run tests while developing your Nitro application.
34+
> The global setup is recommended for most use cases where only one Nitro application is being developed. It is more convenient to use than the per-test-suite setup because it keeps the Nitro development server running in the background ([localhost:3000](http://localhost:3000) by default) in Vitest watch mode. This allows you to develop your Nitro application and write tests at the same time.
3535
3636
### Global Nitro Build
3737

src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export async function defineConfig(userConfig: ViteUserConfig = {}): Promise<Vit
4848
const resolvedGlobalConfig: NitroInlineConfig['global'] = userConfig.nitro?.global === true ? {} : userConfig.nitro?.global || undefined
4949
const resolvedNitroConfig: NitroInlineConfig = {
5050
...userConfig.nitro,
51+
rerunOnSourceChanges: userConfig.nitro?.rerunOnSourceChanges ?? true,
5152
global: resolvedGlobalConfig
5253
? {
5354
rootDir: userConfig.nitro?.rootDir || resolvedGlobalConfig.rootDir || undefined,
@@ -72,7 +73,7 @@ export async function defineConfig(userConfig: ViteUserConfig = {}): Promise<Vit
7273
// Custom triggers
7374
...(userConfig.test?.forceRerunTriggers ?? []),
7475
// Rerun tests when source files change
75-
...((resolvedNitroConfig.rerunOnSourceChanges ?? true)
76+
...(resolvedNitroConfig.rerunOnSourceChanges
7677
? resolvedNitroConfig.global
7778
? [join(
7879
resolvedNitroConfig.global?.rootDir || '',

0 commit comments

Comments
 (0)