Skip to content

Commit bf0dca5

Browse files
authored
Merge pull request #72 from matthewcsimpson/improvement/simple-range-slider
Improvement/simple range slider
2 parents 97b861e + c8eaab9 commit bf0dca5

27 files changed

Lines changed: 1749 additions & 533 deletions

.github/workflows/tests.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,34 @@ jobs:
3232
run: npx jest --runInBand --coverage --coverageReporters=text-summary --coverageReporters=lcov --coverageReporters=json-summary
3333

3434
- name: Upload coverage artifact
35-
if: always()
35+
if: always() && hashFiles('coverage/coverage-summary.json') != ''
3636
uses: actions/upload-artifact@v4
3737
with:
3838
name: coverage
3939
path: coverage/**
4040

4141
- name: Add coverage summary to job summary
42-
if: always()
42+
if: always() && hashFiles('coverage/coverage-summary.json') != ''
4343
shell: bash
4444
run: |
45-
node -e "const fs=require('fs');const p='coverage/coverage-summary.json';if(fs.existsSync(p)){const s=JSON.parse(fs.readFileSync(p,'utf8'));const t=(o)=>o.total;const c=t(s);const md=\`## Coverage summary\\n\\n- Statements: \${c.statements.pct}% (\${c.statements.covered}/\${c.statements.total})\\n- Branches: \${c.branches.pct}% (\${c.branches.covered}/\${c.branches.total})\\n- Functions: \${c.functions.pct}% (\${c.functions.covered}/\${c.functions.total})\\n- Lines: \${c.lines.pct}% (\${c.lines.covered}/\${c.lines.total})\\n\`;fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, md);}else{console.log('coverage-summary.json not found')}}"
45+
node <<'NODE'
46+
const fs = require('fs');
47+
const p = 'coverage/coverage-summary.json';
48+
const out = process.env.GITHUB_STEP_SUMMARY;
49+
if (!out) {
50+
console.log('GITHUB_STEP_SUMMARY not set; skipping');
51+
process.exit(0);
52+
}
53+
const s = JSON.parse(fs.readFileSync(p, 'utf8'));
54+
const c = s.total;
55+
const lines = [
56+
'## Coverage summary',
57+
'',
58+
`- Statements: ${c.statements.pct}% (${c.statements.covered}/${c.statements.total})`,
59+
`- Branches: ${c.branches.pct}% (${c.branches.covered}/${c.branches.total})`,
60+
`- Functions: ${c.functions.pct}% (${c.functions.covered}/${c.functions.total})`,
61+
`- Lines: ${c.lines.pct}% (${c.lines.covered}/${c.lines.total})`,
62+
'',
63+
];
64+
fs.appendFileSync(out, lines.join('\n'));
65+
NODE

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules/
2-
.vscode/
2+
.vscode/
3+
coverage/

0 commit comments

Comments
 (0)