Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f480829
chore: simplify test/ structure
sheremet-va Dec 31, 2025
b9dd03d
chore: move more
sheremet-va Dec 31, 2025
9e779a2
chore: cleanup
sheremet-va Dec 31, 2025
dd851ce
chore: move watch
sheremet-va Dec 31, 2025
73cc903
chore: cleanup
sheremet-va Dec 31, 2025
c85f316
chore: lockfile
sheremet-va Dec 31, 2025
dc4a7fe
Merge branch 'main' of github.com:vitest-dev/vitest into chore/simpli…
sheremet-va Jan 9, 2026
97dacb0
chore: pnpm lockfile
sheremet-va Jan 9, 2026
7568177
test: remove "globals: true" in CLI
sheremet-va Jan 9, 2026
0f277d7
chore: move reporters
sheremet-va Jan 9, 2026
c313629
chore: remove extra lines
sheremet-va Jan 9, 2026
7a3db45
chore: fix
sheremet-va Jan 9, 2026
580fe35
chore: use onTestFinished
sheremet-va Jan 9, 2026
884388b
chore: setup is empty
sheremet-va Jan 9, 2026
d546d52
chore: lint
sheremet-va Jan 9, 2026
0d7ba6f
chore: update exports test
sheremet-va Jan 9, 2026
db07de2
test: remove only
sheremet-va Jan 9, 2026
da5d5e1
test: fix junit hostname
sheremet-va Jan 9, 2026
ac1662a
test: fix crlf
sheremet-va Jan 9, 2026
6fdbddc
Merge branch 'main' of github.com:vitest-dev/vitest into chore/simpli…
sheremet-va Jan 9, 2026
93ff37e
Merge branch 'main' into chore/simplify-test-structure
sheremet-va Jan 9, 2026
6307bf1
chore: rewrite to use inline
sheremet-va Jan 9, 2026
a3a0f0b
chore: set config to false
sheremet-va Jan 9, 2026
dd17890
test: stabilize tests
sheremet-va Jan 9, 2026
0b8d377
chore: lint
sheremet-va Jan 9, 2026
3de378f
test: move some of the config tests
sheremet-va Jan 9, 2026
8ea2d61
fix: vite server didn't close properly
sheremet-va Jan 12, 2026
3401cd0
chore: fs cached check
sheremet-va Jan 12, 2026
96d543d
test: rewrite to use inline tests
sheremet-va Jan 12, 2026
a28bccd
Merge branch 'main' of github.com:vitest-dev/vitest into chore/simpli…
sheremet-va Jan 12, 2026
6700dd0
chore: update links
sheremet-va Jan 12, 2026
8b6c623
chore: ignore pkg.json for rerun
sheremet-va Jan 12, 2026
6fc845a
chore: return html
sheremet-va Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto eol=lf

test/reporters/fixtures/indicator-position.test.js eol=crlf
test/cli/fixtures/reporters/indicator-position.test.js eol=crlf
22 changes: 8 additions & 14 deletions packages/browser/src/node/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import type {
import type { ParentBrowserProject } from './projectParent'
import { existsSync } from 'node:fs'
import { readFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { resolve } from 'pathe'
import { distRoot } from './constants'
import { BrowserServerState } from './state'
import { getBrowserProvider } from './utils'

Expand All @@ -25,41 +25,35 @@ export class ProjectBrowser implements IProjectBrowser {

public provider!: BrowserProvider
public vitest: Vitest
public vite: ViteDevServer
public config: ResolvedConfig
public children: Set<ProjectBrowser> = new Set<ProjectBrowser>()

public parent!: ParentBrowserProject

public state: BrowserServerState = new BrowserServerState()

constructor(
public parent: ParentBrowserProject,
public project: TestProject,
public base: string,
) {
this.vitest = project.vitest
this.config = project.config
this.vite = parent.vite

const pkgRoot = resolve(fileURLToPath(import.meta.url), '../..')
const distRoot = resolve(pkgRoot, 'dist')

// instances can override testerHtmlPath
const testerHtmlPath = project.config.browser.testerHtmlPath
? resolve(project.config.root, project.config.browser.testerHtmlPath)
: resolve(distRoot, 'client/tester/tester.html')
// TODO: when config resolution is rewritten, project and parentProject should be created before the vite server is started
if (!existsSync(testerHtmlPath)) {
throw new Error(`Tester HTML file "${testerHtmlPath}" doesn't exist.`)
}
this.testerFilepath = testerHtmlPath

this.testerHtml = readFile(
testerHtmlPath,
this.testerFilepath,
'utf8',
).then(html => (this.testerHtml = html))
}

get vite(): ViteDevServer {
return this.parent.vite
}

private commands = {} as Record<string, BrowserCommand<any, any>>

public registerCommand<K extends keyof BrowserCommands>(
Expand Down Expand Up @@ -130,7 +124,7 @@ export class ProjectBrowser implements IProjectBrowser {
}

async close(): Promise<void> {
await this.parent.vite.close()
await this.vite.close()
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/browser/src/node/projectParent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ export class ParentBrowserProject {
throw new Error(`Cannot spawn child server without a parent dev server.`)
}
const clone = new ProjectBrowser(
this,
project,
'/',
)
clone.parent = this
this.children.add(clone)
return clone
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export class TestProject {
[
this.vite?.close(),
this.typechecker?.stop(),
this.browser?.close(),
(this.browser || this._parent?._parentBrowser?.vite)?.close(),
this.clearTmpDir(),
].filter(Boolean),
).then(() => {
Expand Down
6 changes: 5 additions & 1 deletion packages/vitest/src/node/reporters/junit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export interface JUnitOptions {
* @default false
*/
addFileAttribute?: boolean
/**
* Hostname to use in the report. By default, it uses os.hostname()
*/
hostname?: string
}

function flattenTasks(task: Task, baseName = ''): Task[] {
Expand Down Expand Up @@ -373,7 +377,7 @@ export class JUnitReporter implements Reporter {
{
name: filename,
timestamp: new Date().toISOString(),
hostname: hostname(),
hostname: this.options.hostname || hostname(),
tests: file.tasks.length,
failures: file.stats.failures,
errors: 0, // An errored test is one that had an unanticipated problem. We cannot detect those.
Expand Down
120 changes: 36 additions & 84 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading