Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add --no-open option #635

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add option to skip automatic opening of UI
  • Loading branch information
DerYeger committed Jan 26, 2022
commit d048ef00d49dc315c37231c0202500e144bbc018
1 change: 1 addition & 0 deletions packages/vitest/src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cli
.option('-w, --watch', 'watch mode')
.option('-t, --testNamePattern <pattern>', 'run test names with the specified pattern')
.option('--ui', 'open UI')
.option('--no-open', 'do not open UI automatically')
.option('--api [api]', 'serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort')
.option('--threads', 'enabled threads', { default: true })
.option('--silent', 'silent console output from tests')
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function VitestPlugin(options: UserConfig = {}, viteOverrides: Vite
},
server: {
...options.api,
open: options.ui
open: options.ui && !options.noOpen
? options.uiBase ?? '/__vitest__/'
: undefined,
preTransformRequests: false,
Expand Down
7 changes: 7 additions & 0 deletions packages/vitest/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ export interface InlineConfig {
*/
ui?: boolean

/**
* Do not open UI automatically.
*
* @default false
*/
noOpen?: boolean

/**
* Base url for the UI
*
Expand Down