You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -57,6 +58,8 @@ Vitest will wait until `runTests` is executed before finishing a run (i.e., it w
57
58
58
59
If you are using a custom pool, you will have to provide test files and their results yourself - you can reference [`vitest.state`](https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/node/state.ts) for that (most important are `collectFiles` and `updateTasks`). Vitest uses `startTests` function from `@vitest/runner` package to do that.
59
60
61
+
Vitest will call `collectTests` if `vitest.collect` is called or `vitest list` is invoked via a CLI command. It works the same way as `runTests`, but you don't have to run test callbacks, only report their tasks by calling `vitest.state.collectFiles(files)`.
62
+
60
63
To communicate between different processes, you can create methods object using `createMethodsRPC` from `vitest/node`, and use any form of communication that you prefer. For example, to use WebSockets with `birpc` you can write something like this:
Copy file name to clipboardExpand all lines: docs/guide/cli.md
+30
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,36 @@ export default {
55
55
56
56
Run only [benchmark](https://vitest.dev/guide/features.html#benchmarking-experimental) tests, which compare performance results.
57
57
58
+
### `vitest init`
59
+
60
+
`vitest init <name>` can be used to setup project configuration. At the moment, it only supports [`browser`](/guide/browser) value:
61
+
62
+
```bash
63
+
vitest init browser
64
+
```
65
+
66
+
### `vitest list`
67
+
68
+
`vitest list` command inherits all `vitest` options to print the list of all matching tests. This command ignores `reporters` option. By default, it will print the names of all tests that matched the file filter and name pattern:
69
+
70
+
```shell
71
+
vitest list filename.spec.ts -t="some-test"
72
+
```
73
+
74
+
```txt
75
+
describe > some-test
76
+
describe > some-test > test 1
77
+
describe > some-test > test 2
78
+
```
79
+
80
+
You can pass down `--json` flag to print tests in JSON format or save it in a separate file:
81
+
82
+
```bash
83
+
vitest list filename.spec.ts -t="some-test" --json=./file.json
84
+
```
85
+
86
+
If `--json` flag doesn't receive a value, it will output the JSON into stdout.
0 commit comments