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

fix(browser): optimize expect-type #6713

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions packages/browser/src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export default (browserServer: BrowserServer, base = '/'): Plugin[] => {
}

const include = [
'vitest > expect-type',
'vitest > @vitest/snapshot > magic-string',
'vitest > chai',
'vitest > chai > loupe',
Expand Down
6 changes: 5 additions & 1 deletion test/browser/specs/runner.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { readFile } from 'node:fs/promises'
import { beforeAll, describe, expect, onTestFailed, test } from 'vitest'
import { browser, runBrowserTests } from './utils'
import { defaultBrowserPort } from 'vitest/config'
import { browser, provider, runBrowserTests } from './utils'

describe('running browser tests', async () => {
let stderr: string
Expand Down Expand Up @@ -28,10 +29,13 @@ describe('running browser tests', async () => {
console.error(stderr)
})

expect(stdout).toContain(`Browser runner started by ${provider} at http://localhost:${defaultBrowserPort}/`)

expect(browserResultJson.testResults).toHaveLength(19)
expect(passedTests).toHaveLength(17)
expect(failedTests).toHaveLength(2)

expect(stderr).not.toContain('optimized dependencies changed')
expect(stderr).not.toContain('has been externalized for browser compatibility')
expect(stderr).not.toContain('Unhandled Error')
})
Expand Down
6 changes: 4 additions & 2 deletions test/cli/test/server-url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { runVitest } from '../../test-utils'

it('api server-url http', async () => {
delete process.env.TEST_HTTPS
const { stdout } = await runVitest({ root: './fixtures/ws-server-url', api: true })
const { stdout, stderr } = await runVitest({ root: './fixtures/ws-server-url', api: true })
expect(stderr).toBe('')
expect(stdout).toContain('API started at http://localhost:51204/')
expect(stdout).toContain('Test Files 1 passed')
})

it('api server-url https', async () => {
process.env.TEST_HTTPS = '1'
const { stdout } = await runVitest({ root: './fixtures/ws-server-url', api: true })
const { stdout, stderr } = await runVitest({ root: './fixtures/ws-server-url', api: true })
expect(stderr).toBe('')
expect(stdout).toContain('API started at https://localhost:51204/')
expect(stdout).toContain('Test Files 1 passed')
})
Expand Down