Skip to content

Commit

Permalink
test: add coverage and codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jun 28, 2021
1 parent 442a594 commit b4a221f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,29 @@ jobs:

- name: Test
run: npm run test

coverage:
runs-on: ubuntu-latest
name: Report coverage to Codecov
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '16'

- name: Setup
run: npm i -g pnpm

- name: Install
run: pnpm i

- name: Build
run: npm run build

- name: Coverage test
run: npm run test:coverage

- name: Upload coverage to Codecov # https://github.com/codecov/codecov-action
uses: codecov/codecov-action@v1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,5 @@ dist

#
lib/
temp/
temp/
coverage/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

A Vite plugin that runs TypeScript, VLS, vue-tsc and other checkers in worker thread.

![npm version](https://img.shields.io/npm/v/vite-plugin-checker) ![downloads/month](https://img.shields.io/npm/dm/vite-plugin-checker) [![Unit Test](https://github.com/fi3ework/vite-plugin-checker/actions/workflows/ci.yml/badge.svg)](https://github.com/fi3ework/vite-plugin-checker/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/vite-plugin-checker)](https://www.npmjs.com/package/vite-plugin-checker) [![downloads/month](https://img.shields.io/npm/dm/vite-plugin-checker)](https://www.npmtrends.com/vite-plugin-checker) [![Unit Test](https://github.com/fi3ework/vite-plugin-checker/actions/workflows/ci.yml/badge.svg)](https://github.com/fi3ework/vite-plugin-checker/actions/workflows/ci.yml)
![codecov](https://codecov.io/gh/fi3ework/vite-plugin-checker/branch/master/graph/badge.svg)

## Features

Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module.exports = {
globalTeardown: './scripts/jestGlobalTeardown.js',
setupFilesAfterEnv: ['./scripts/jestPerTestSetup.ts'],
testTimeout: process.env.CI ? 60000 : 60000,
collectCoverage: true,
collectCoverageFrom: ['packages/*/src/**/*.ts'],
transform: {
'^.+\\.ts$': 'ts-jest',
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"dev": "pnpm -r --filter ./packages --parallel run dev",
"build": "pnpm -r --filter ./packages run build",
"lint": "eslint --ext .js,.ts packages/*/src/**",
"test": "jest --runInBand",
"test": "jest --runInBand --coverage=false",
"test:coverage": "jest --runInBand",
"changelog": "pnpm -r --filter ./packages run changelog",
"test:watch": "jest -w",
"type-check": "pnpm -r --parallel --filter ./packages exec -- tsc --noEmit -p tsconfig.build.json",
Expand Down

0 comments on commit b4a221f

Please sign in to comment.