Skip to content

Commit

Permalink
add Coveralls github workflow (#759)
Browse files Browse the repository at this point in the history
Adds a code coverage workflow using Coveralls
Only static .js files have their coverage collected.
Trying to collect code coverage from hbs files masquerading
as js files causes the coverage reporter to crash, since it
can't parse the hbs portions of the file correctly.

Also adds a code coverage badge to the readme.

J=SLAP-873
TEST=auto
  • Loading branch information
oshi97 authored May 12, 2021
1 parent ab7481a commit 94c60fe
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will run our tests, generate an lcov code coverage file,
# and send that coverage to Coveralls

name: Code Coverage

on:
push:
branches-ignore: dev/*
pull_request:

jobs:
Coveralls:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npx jest tests/static/ --coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Answers Hitchhiker Theme

<div>
<a href='https://coveralls.io/github/yext/answers-hitchhiker-theme?branch=master'>
<img src='https://coveralls.io/repos/github/yext/answers-hitchhiker-theme/badge.svg?branch=master' alt='Coverage Status' />
</a>
</div>

A [Jambo](https://github.com/yext/jambo) theme for building Answers experiences.

Additonal resources for integrating Answers can be found at https://hitchhikers.yext.com/.
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"yargs": "^17.0"
},
"jest": {
"collectCoverageFrom": [
"static/**/*.js"
],
"verbose": true,
"moduleFileExtensions": [
"js"
Expand Down

0 comments on commit 94c60fe

Please sign in to comment.