Skip to content

Commit

Permalink
test: each test case for browser (#3100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslemammad authored Apr 8, 2023
1 parent 430b4ec commit ddbda10
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
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.38.4",
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)
})

0 comments on commit ddbda10

Please sign in to comment.