Skip to content

Commit

Permalink
chore(gost): add browser test dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lsr-explore committed Dec 7, 2024
1 parent 5d8aa98 commit c9f850e
Show file tree
Hide file tree
Showing 5 changed files with 476 additions and 101 deletions.
10 changes: 7 additions & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"build": "vite build && rm dist/deploy-config.js",
"dev": "vite",
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
"test": "vitest"
"test": "vitest",
"test:browser": "vitest --workspace=vitest.workspace.js"
},
"dependencies": {
"@braid/vue-formulate": "^2.5.3",
Expand Down Expand Up @@ -43,7 +44,8 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"@vitest/coverage-istanbul": "^2.1.0",
"@vitest/browser": "^2.1.8",
"@vitest/coverage-istanbul": "^2.1.8",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/test-utils": "^2.4.6",
"eslint": "^8.2.0",
Expand All @@ -58,9 +60,11 @@
"eslint-plugin-vue": "^9.26.0",
"eslint-plugin-vuejs-accessibility": "^2.4.1",
"jsdom": "^24.0.0",
"playwright": "^1.49.0",
"prettier": "2.6.1",
"sass": "1.52.1",
"typescript": "^4.7.2",
"vitest": "^2.1.0"
"vitest": "^2.1.8",
"vitest-browser-vue": "^0.0.1"
}
}
6 changes: 6 additions & 0 deletions packages/client/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,11 @@ export default defineConfig({
'json',
],
},
browser: {
provider: 'playwright',
enabled: false,
headless: true,
name: 'chromium',
},
},
});
10 changes: 10 additions & 0 deletions packages/client/vitest-example/HelloWorld.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { expect, test } from 'vitest'
import { render } from 'vitest-browser-vue'

Check failure on line 2 in packages/client/vitest-example/HelloWorld.test.js

View workflow job for this annotation

GitHub Actions / qa / Test client-side code

vitest-example/HelloWorld.test.js

Error: @vitest/browser/context can be imported only inside the Browser Mode. Your test is running in forks pool. Make sure your regular tests are excluded from the "test.include" glob pattern. ❯ ../../node_modules/@vitest/browser/context.js:12:7 ❯ vitest-example/HelloWorld.test.js:2:31
import HelloWorld from './HelloWorld.vue'

test('renders name', async () => {
const { getByText } = render(HelloWorld, {
props: { name: 'Vitest' },
})
await expect.element(getByText('Hello Vitest!')).toBeInTheDocument()
})
11 changes: 11 additions & 0 deletions packages/client/vitest-example/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup>
defineProps({
name: String
})
</script>

<template>
<div>
<h1>Hello {{ name }}!</h1>
</div>
</template>
Loading

0 comments on commit c9f850e

Please sign in to comment.