CI: Support uploading frontend unit test coverage. (#2772)

* CI: Support uploading frontend unit test coverage.

* Add make-i18n before test.

* Update vitest configuration to include only .ts and .tsx files in coverage.

* remove .only in test and fix the failed tests.

* Add text summary.

* Move vite-tsconfig-paths to dev dep. Adjust UTs.

---------

Signed-off-by: ifuryst <ifuryst@gmail.com>
Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
This commit is contained in:
Leo
2024-07-06 12:16:30 +08:00
committed by GitHub
parent f6dc89b41a
commit 9b0ff117ab
7 changed files with 155 additions and 65 deletions

View File

@@ -19,6 +19,35 @@ env:
PERSIST_SANDBOX : "false"
jobs:
fe-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Run tests and collect coverage
working-directory: ./frontend
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-on-macos:
name: Test on macOS
runs-on: macos-12