Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat-breaking-fn-mock-typing' in…
Browse files Browse the repository at this point in the history
…to feat-breaking-fn-mock-typing
  • Loading branch information
hi-ogawa committed Jun 21, 2024
2 parents 72adccf + b417c3e commit 1946007
Show file tree
Hide file tree
Showing 72 changed files with 3,969 additions and 853 deletions.
10 changes: 7 additions & 3 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ browser-like environment through either [`jsdom`](https://github.com/jsdom/jsdom
or [`happy-dom`](https://github.com/capricorn86/happy-dom) instead.
If you are building edge functions, you can use [`edge-runtime`](https://edge-runtime.vercel.app/packages/vm) environment

::: tip
You can also use [Browser Mode](/guide/browser) to run integration or unit tests in the browser without mocking the environment.
:::

By adding a `@vitest-environment` docblock or comment at the top of the file,
you can specify another environment to be used for all tests in that file:

Expand Down Expand Up @@ -896,7 +900,7 @@ Pass additional arguments to `node` process in the VM context. See [Command-line
Be careful when using, it as some options may crash worker, e.g. --prof, --title. See https://github.com/nodejs/node/issues/41103.
:::

### fileParallelism {#fileparallelism}
### fileParallelism<NonProjectOption /> {#fileparallelism}

- **Type:** `boolean`
- **Default:** `true`
Expand All @@ -908,13 +912,13 @@ Should all test files run in parallel. Setting this to `false` will override `ma
This option doesn't affect tests running in the same file. If you want to run those in parallel, use `concurrent` option on [describe](/api/#describe-concurrent) or via [a config](#sequence-concurrent).
:::

### maxWorkers {#maxworkers}
### maxWorkers<NonProjectOption /> {#maxworkers}

- **Type:** `number`

Maximum number of workers to run tests in. `poolOptions.{threads,vmThreads}.maxThreads`/`poolOptions.forks.maxForks` has higher priority.

### minWorkers {#minworkers}
### minWorkers<NonProjectOption /> {#minworkers}

- **Type:** `number`

Expand Down
474 changes: 384 additions & 90 deletions docs/guide/browser.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default antfu(
'**/bench.json',
'**/fixtures',
'**/assets/**',
'**/*.d.ts',
'**/*.timestamp-*',
'test/core/src/self',
'test/cache/cache/.vitest-base/results.json',
Expand Down
5 changes: 5 additions & 0 deletions packages/browser/context.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export interface FsOptions {
flag?: string | number
}

export interface CDPSession {
// methods are defined by the provider type augmentation
}

export interface ScreenshotOptions {
element?: Element
/**
Expand Down Expand Up @@ -242,3 +246,4 @@ export interface BrowserPage {
}

export const page: BrowserPage
export const cdp: () => CDPSession
Loading

0 comments on commit 1946007

Please sign in to comment.