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

test: each test case for browser #3100

Merged
merged 7 commits into from
Apr 8, 2023
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
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,43 @@ jobs:
env:
BROWSER: ${{ matrix.browser[1] }}

test-browser-windows:
runs-on: windows-latest
strategy:
matrix:
browser: [[chrome, chromium], [edge, webkit]]

timeout-minutes: 10

env:
BROWSER: ${{ matrix.browser[0] }}
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-and-cache
with:
node-version: 18

- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-edge@v1

- name: Install
run: pnpm i

- name: Install Playwright Dependencies
run: pnpx playwright install-deps

- name: Build
run: pnpm run build

- name: Test Browser (webdriverio)
run: pnpm run test:browser:webdriverio

- name: Test Browser (playwright)
run: pnpm run test:browser:playwright
env:
BROWSER: ${{ matrix.browser[1] }}

test-browser-safari:
runs-on: macos-latest
timeout-minutes: 10
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"ui:build": "vite build packages/ui",
"ui:dev": "vite packages/ui",
"ui:test": "npm -C packages/ui run test:run",
"test:browser:webdriverio": "npm -C test/browser run test:webdriverio",
"test:browser:playwright": "npm -C test/browser run test:playwright"
"test:browser:webdriverio": "pnpm -C test/browser run test:webdriverio",
"test:browser:playwright": "pnpm -C test/browser run test:playwright"
},
"devDependencies": {
"@antfu/eslint-config": "^0.34.1",
Expand Down
1 change: 1 addition & 0 deletions packages/vitest/src/integrations/browser/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export async function createBrowserServer(ctx: Vitest, options: UserConfig) {
}

config.server = server
config.server.fs = { strict: false }

config.optimizeDeps ??= {}
config.optimizeDeps.entries ??= []
Expand Down
7 changes: 7 additions & 0 deletions test/browser/test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ it('basic', async () => {
it('basic 2', () => {
expect(globalThis.window).toBeDefined()
})

it.each([
['x', true],
['y', false],
])('%s is x', (val, expectedResult) => {
expect(val === 'x').toBe(expectedResult)
})