Skip to content

Update vite.config.js #90

Update vite.config.js

Update vite.config.js #90

Workflow file for this run

name: Codecov CI with Vitest (final fully portable version)
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Initialize clean package.json
run: |
npm init -y
npm install vitest@1.6.1 @vitest/coverage-v8@1.6.1
- name: Add test script manually
run: |
jq '.scripts.test="vitest run --coverage"' package.json > tmp.json && mv tmp.json package.json
- name: Create vitest.config.ts
run: |
echo "import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
include: ['app/**/*.test.js'],
coverage: {
provider: 'v8',
reporters: ['text', 'json', 'html', 'lcov'],
reportDir: 'coverage'
},
reporters: [
'default',
['junit', { outputFile: 'junit.xml' }]
]
}
})" > vitest.config.ts
- name: Run tests with coverage
run: npm run test || true
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}