Skip to content

Commit 310d66d

Browse files
authored
Enable vitest test reports + upload artifacts (#325)
This way we can extract the test reports and view them offline Co-authored-by: Mackenzie Zastrow <[email protected]>
1 parent e282048 commit 310d66d

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

.github/workflows/integration-test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,12 @@ jobs:
8686
- name: Run integration tests
8787
run: npm run test:integ:all
8888

89-
- name: Upload browser test screenshots
89+
- name: Upload test artifacts
9090
if: always()
9191
uses: actions/upload-artifact@v5
9292
with:
93-
name: browser-test-screenshots
94-
path: tests_integ/browser/__screenshots__/
93+
name: test-artifacts-integ
94+
path: ./test/.artifacts/
9595
retention-days: 4
96+
include-hidden-files: true # needed because the path has a directory starting with a '.'
9697
if-no-files-found: ignore

.github/workflows/test-lint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ jobs:
4040
- name: Run unit tests
4141
run: npm run test:all:coverage
4242

43+
- name: Upload test artifacts
44+
if: always()
45+
uses: actions/upload-artifact@v5
46+
with:
47+
name: test-artifacts-${{ matrix.node-version }}-${{ matrix.os }}
48+
path: ./test/.artifacts/
49+
include-hidden-files: true # needed because the path has a directory starting with a '.'
50+
retention-days: 4
51+
if-no-files-found: ignore
52+
4353
- name: Run linting
4454
run: npm run lint
4555

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ Thumbs.db
3737
.env.production.local
3838

3939
# Github workflow artifacts
40-
.artifact
40+
.artifact
41+
42+
# Test artifacts
43+
test/.artifacts

vitest.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ const getOpenAIAPIKey: BrowserCommand<[], string | undefined> = async ({ testPat
2323
export default defineConfig({
2424
test: {
2525
unstubEnvs: true,
26+
reporters: [
27+
'default',
28+
['junit', { outputFile: 'test/.artifacts/test-report/junit/report.xml' }],
29+
['json', { outputFile: 'test/.artifacts/test-report/json/report.json' }],
30+
],
2631
projects: [
2732
{
2833
test: {
@@ -43,6 +48,7 @@ export default defineConfig({
4348
browser: {
4449
enabled: true,
4550
provider: playwright(),
51+
screenshotDirectory: 'test/.artifacts/browser-screenshots/',
4652
instances: [
4753
{
4854
browser: 'chromium',
@@ -72,6 +78,7 @@ export default defineConfig({
7278
browser: {
7379
enabled: true,
7480
provider: playwright(),
81+
screenshotDirectory: 'test/.artifacts/browser-screenshots/',
7582
instances: [
7683
{
7784
browser: 'chromium',

0 commit comments

Comments
 (0)