Skip to content

Commit 874a610

Browse files
committed
build: restrict coverage filter and guard against division by zero
1 parent cf58c6f commit 874a610

23 files changed

Lines changed: 40 additions & 29 deletions

File tree

.github/workflows/scripts/run_tests_coverage

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ main() {
160160
# For each package, extract coverage values from the respective coverage report:
161161
pkg=`echo $package | sed -E 's/^.*stdlib\///'`
162162

163-
make test-javascript-cov TESTS_FILTER=".*/${pkg}/.*"
163+
make test-javascript-cov TESTS_FILTER=".*/${pkg}/test/.*"
164164

165165
if [ ! -f reports/coverage/lcov-report/${pkg}/lib/index.html ]; then
166166
# Reports for packages with no dependencies are stored in the `lcov-report` directory
@@ -171,7 +171,7 @@ main() {
171171
coverage_path="reports/coverage/lcov-report/${pkg}/lib/index.html"
172172
top_level_report=false
173173
fi
174-
pkg_cov_values=($(cat $coverage_path | grep "fraction" | grep -oP '\d+/\d+' | awk -F'/' '{print $1/$2}'))
174+
pkg_cov_values=($(cat $coverage_path | grep "fraction" | grep -oP '\d+/\d+' | awk -F'/' '{if ($2 != 0) print $1/$2; else print 1}'))
175175
pkg_statements_cov=${pkg_cov_values[0]}
176176
pkg_branches_cov=${pkg_cov_values[1]}
177177
pkg_functions_cov=${pkg_cov_values[2]}
@@ -190,7 +190,7 @@ main() {
190190
old_functions_cov=0
191191
old_lines_cov=0
192192
else
193-
old_cov_values=($(echo "$old_cov_report" | grep "fraction" | grep -oP '\d+/\d+' | awk -F'/' '{print $1/$2}'))
193+
old_cov_values=($(echo "$old_cov_report" | grep "fraction" | grep -oP '\d+/\d+' | awk -F'/' '{if ($2 != 0) print $1/$2; else print 1}'))
194194
old_statements_cov=${old_cov_values[0]}
195195
old_branches_cov=${old_cov_values[1]}
196196
old_functions_cov=${old_cov_values[2]}
@@ -204,8 +204,8 @@ main() {
204204

205205
pkg_cov="| $pkg_statements_cov_fraction <br> $cov_change_statements | $pkg_branches_cov_fraction <br> $cov_change_branches | $pkg_functions_cov_fraction <br> $cov_change_functions | $pkg_lines_cov_fraction <br> $cov_change_lines |"
206206

207-
pkg_url="https://coverage.stdlib.io/${pkg}"
208-
pkg_link="<a href='"$pkg_url"'>$pkg</a>"
207+
pkg_url="https://coverage.stdlib.io/${pkg}/lib/index.html"
208+
pkg_link="<a href="$pkg_url">$pkg</a>"
209209
coverage="$coverage\n| $pkg_link $pkg_cov"
210210

211211
# Copy coverage report of the package to artifacts directory:
@@ -214,7 +214,7 @@ main() {
214214
else
215215
mkdir -p "artifacts/${pkg}/lib/" && cp -r "reports/coverage/lcov-report/${pkg}/lib"/* "artifacts/${pkg}/lib/"
216216
fi
217-
217+
218218
# Cleanup coverage reports for next package:
219219
rm -rf reports/coverage/lcov-report/*
220220
done

lib/node_modules/@stdlib/_tools/github/create-issue/test/test.ratelimit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function setup() {
3838

3939
// TESTS //
4040

41-
tape( 'the main export is a function', function test( t ) {
41+
tape( 'main export is a function', function test( t ) {
42+
t.ok( true, __filename );
4243
t.equal( typeof ratelimit, 'function', 'main export is a function' );
4344
t.end();
4445
});

lib/node_modules/@stdlib/_tools/github/create-repo/test/test.ratelimit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function setup() {
3838

3939
// TESTS //
4040

41-
tape( 'the main export is a function', function test( t ) {
41+
tape( 'main export is a function', function test( t ) {
42+
t.ok( true, __filename );
4243
t.equal( typeof ratelimit, 'function', 'main export is a function' );
4344
t.end();
4445
});

lib/node_modules/@stdlib/_tools/github/create-token/test/test.ratelimit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function setup() {
3838

3939
// TESTS //
4040

41-
tape( 'the main export is a function', function test( t ) {
41+
tape( 'main export is a function', function test( t ) {
42+
t.ok( true, __filename );
4243
t.equal( typeof ratelimit, 'function', 'main export is a function' );
4344
t.end();
4445
});

lib/node_modules/@stdlib/_tools/github/delete-token/test/test.ratelimit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function setup() {
3838

3939
// TESTS //
4040

41-
tape( 'the main export is a function', function test( t ) {
41+
tape( 'main export is a function', function test( t ) {
42+
t.ok( true, __filename );
4243
t.equal( typeof ratelimit, 'function', 'main export is a function' );
4344
t.end();
4445
});

lib/node_modules/@stdlib/_tools/github/dispatch-workflow/test/test.ratelimit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ function setup() {
3838

3939
// TESTS //
4040

41-
tape( 'the main export is a function', function test( t ) {
41+
tape( 'main export is a function', function test( t ) {
42+
t.ok( true, __filename );
4243
t.equal( typeof ratelimit, 'function', 'main export is a function' );
4344
t.end();
4445
});

lib/node_modules/@stdlib/_tools/github/get/test/test.cache.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ var create = require( './../lib/cache.js' );
2727

2828
// TESTS //
2929

30-
tape( 'the main export is a function', function test( t ) {
30+
tape( 'main export is a function', function test( t ) {
31+
t.ok( true, __filename );
3132
t.equal( typeof create, 'function', 'main export is a function' );
3233
t.end();
3334
});

lib/node_modules/@stdlib/_tools/github/get/test/test.checklimit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function setup() {
3939

4040
// TESTS //
4141

42-
tape( 'the main export is a function', function test( t ) {
42+
tape( 'main export is a function', function test( t ) {
43+
t.ok( true, __filename );
4344
t.equal( typeof checklimit, 'function', 'main export is a function' );
4445
t.end();
4546
});

lib/node_modules/@stdlib/_tools/github/get/test/test.factory.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ var info = require( './fixtures/info.json' );
3535

3636
// TESTS //
3737

38-
tape( 'the main export is a function', function test( t ) {
38+
tape( 'main export is a function', function test( t ) {
39+
t.ok( true, __filename );
3940
t.equal( typeof factory, 'function', 'main export is a function' );
4041
t.end();
4142
});

lib/node_modules/@stdlib/_tools/github/get/test/test.flatten.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ var flatten = require( './../lib/flatten.js' );
2626

2727
// TESTS //
2828

29-
tape( 'the main export is a function', function test( t ) {
29+
tape( 'main export is a function', function test( t ) {
30+
t.ok( true, __filename );
3031
t.equal( typeof flatten, 'function', 'main export is a function' );
3132
t.end();
3233
});

0 commit comments

Comments
 (0)