Skip to content

Commit

Permalink
add test-cov and workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uiolee committed Apr 6, 2024
1 parent b72b4e1 commit b4d5bc1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
File renamed without changes.
42 changes: 30 additions & 12 deletions .github/workflows/tester.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Tester

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:

jobs:
tester:
Expand All @@ -11,20 +15,34 @@ jobs:
node-version: ['14.x', '16.x', '18.x']
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }} and Cache
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Cache NPM dependencies
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-npm-cache
restore-keys: ${{ runner.os }}-npm-cache
cache: npm
cache-dependency-path: "package.json"
- name: Install Dependencies
run: npm install
- name: Test
run: npm run test
env:
CI: true

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js 14 and Cache
uses: actions/setup-node@v4
with:
node-version: 14
cache: npm
cache-dependency-path: "package.json"
- name: Install Dependencies
run: npm install
- name: Coverage
run: npm run test-cov
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
node_modules/
package-lock.json
tmp/
*.log
*.log
coverage
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
"scripts": {
"eslint": "eslint .",
"test": "mocha test/index.js"
"test": "mocha test/index.js",
"test-cov": "c8 -r lcovonly mocha test/index.js"
},
"repository": {
"type": "git",
Expand All @@ -44,6 +45,7 @@
"mathjax": "^3.2.2"
},
"devDependencies": {
"c8": "^9.1.0",
"chai": "^4.4.1",
"eslint": "^8.57.0",
"eslint-config-hexo": "^5.0.0",
Expand Down
File renamed without changes.

0 comments on commit b4d5bc1

Please sign in to comment.