Skip to content

Commit

Permalink
improve vitest config
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Mar 28, 2024
1 parent f6370af commit bc282f5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci/getTestJobs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ async function getTestJobs() {
// Unit tests
{
jobName: 'Unit Tests',
jobCmd: 'pnpm run test:units',
jobCmd: 'pnpm exec vitest run',
jobTestFiles: specFiles,
jobSetups: [{ os: 'ubuntu-latest', node_version: '18' }]
},
// Typecheck `.ts` files
{
jobName: 'TypeScript',
jobCmd: 'pnpm run test:types',
jobCmd: 'pnpm exec test-types',
jobSetups: [{ os: 'ubuntu-latest', node_version: '18' }]
},
// E2e tests
Expand Down Expand Up @@ -99,7 +99,7 @@ async function crawlE2eJobs(testFiles) {
jobName,
jobTestFiles: [],
jobSetups,
jobCmd: 'pnpm run test:e2e'
jobCmd: 'pnpm exec test-e2e'
})
})
}
Expand Down Expand Up @@ -144,7 +144,7 @@ async function crawlE2eJobs(testFiles) {
if (!job) {
job = {
jobName: 'E2E Tests',
jobCmd: 'pnpm run test:e2e',
jobCmd: 'pnpm exec test-e2e',
jobTestFiles: [],
jobSetups: [{ os: 'ubuntu-latest', node_version: '20' }]
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"build": "cd vike/ && pnpm run build",
"========= Test": "",
"// Run tests": "",
"test": "pnpm run test:units && pnpm run test:e2e && pnpm run test:types",
"test:units": "vitest run",
"test:e2e": "test-e2e",
"test": "vitest run && test-e2e && test-types",
"test:units": "vitest run --project unit",
"test:e2e": "vitest run --project e2e && test-e2e",
"test:types": "test-types",
"// https://github.com/vitejs/vite-ecosystem-ci/blob/6b5e66429c57047394cf7b7d8e052532ea03a414/tests/vike.ts#L14": "",
"test:vite-ecosystem-ci": "(export VITE_ECOSYSTEM_CI=true; pnpm run test:units && pnpm run test:e2e --exclude test-deprecated-design && pnpm run test:types)",
"test:vite-ecosystem-ci": "(export VITE_ECOSYSTEM_CI=true; vitest run && test-e2e --exclude test-deprecated-design && test-types)",
"========= Docs": "",
"// Develop website https://vike.dev": "",
"docs": "cd docs/ && pnpm run dev",
Expand Down
9 changes: 0 additions & 9 deletions vitest.config.ts

This file was deleted.

17 changes: 17 additions & 0 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineWorkspace } from 'vitest/config'

export default defineWorkspace([
{
test: {
include: ['vike/**/*.spec.ts'],
name: 'unit'
}
},
{
test: {
// test/**/*.test.ts => @brillout/test-e2e
include: ['test/**/*.spec.ts'],
name: 'e2e'
}
}
])

0 comments on commit bc282f5

Please sign in to comment.