Skip to content

Commit

Permalink
add jest cov report markdown action
Browse files Browse the repository at this point in the history
  • Loading branch information
mfleader committed Oct 10, 2023
1 parent 8f137a7 commit 9c469c3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 15 deletions.
38 changes: 23 additions & 15 deletions .github/workflows/cdm-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,36 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: "18"

- name: enforce javascript style standard
run: npx prettier **/*.js --check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
- name: code coverage
uses: ArtiomTr/jest-coverage-report-action@v2
id: coverage
with:
python-version: 3.9
output: report-markdown
working-directory: queries

- name: install html to markdown converter
run: pip install html2text
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: 3.9

- name: check unit tests
run: npm test --prefix=queries --coverageDirectory=coverage
# - name: install html to markdown converter
# run: pip install html2text

- name: convert test coverage to markdown
run: html2text --ignore-image --ignore-links -b 0 queries/coverage/lcov-report/index.html >> $GITHUB_STEP_SUMMARY
# - name: check unit tests
# run: npm test --prefix=queries --coverageDirectory=coverage

- name: upload coverage html artifact
uses: actions/upload-artifact@v3
with:
name: coverage
path: queries/coverage
if-no-files-found: error
# - name: convert test coverage to markdown
# run: html2text --ignore-image --ignore-links -b 0 queries/coverage/lcov-report/index.html >> $GITHUB_STEP_SUMMARY

# - name: upload coverage html artifact
# uses: actions/upload-artifact@v3
# with:
# name: coverage
# path: queries/coverage
# if-no-files-found: error
30 changes: 30 additions & 0 deletions queries/test/cdm.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { describe, expect, test } = require('@jest/globals');

const cdm = require('../cdmq/cdm.js');

describe('set(ish)-array behavior', () => {
Expand Down Expand Up @@ -27,5 +28,34 @@ describe('set(ish)-array behavior', () => {
});
});

// const { t } = require('tap');

// t.test('set(ish) difference (subtractTwoArrays)', t => {
// a0 = [1, 1, 2];
// a1 = [2, 2, 3];

// t.matchOnlyStrict(cdm.subtractTwoArrays(a0, a1), [1, 1]);
// t.matchOnlyStrict(cdm.subtractTwoArrays(a1, a0), [3]);
// t.end();
// });

// t.test('set(ish) intersection (intersectTwoArrays)', t => {
// a0 = [1, 1, 2];
// a1 = [2, 2, 3];

// t.matchOnlyStrict(cdm.intersectTwoArrays(a0, a1), [2]);
// t.matchOnlyStrict(cdm.intersectTwoArrays(a1, a0), [2, 2]);
// t.end();
// });

// t.test('intersect all arrays', t => {
// a0 = [1, 1, 2];
// a1 = [2, 2, 3];
// a2 = [4, 4, 2];
// a = [a0, a1, a2];
// t.matchOnlyStrict(cdm.intersectAllArrays(a), [2]);
// t.end()
// });



0 comments on commit 9c469c3

Please sign in to comment.