Skip to content

tests: add istanbul coverage for tests#2470

Open
jankapunkt wants to merge 1 commit intoSortableJS:masterfrom
jankapunkt:tests/coverage
Open

tests: add istanbul coverage for tests#2470
jankapunkt wants to merge 1 commit intoSortableJS:masterfrom
jankapunkt:tests/coverage

Conversation

@jankapunkt
Copy link
Copy Markdown

@jankapunkt jankapunkt commented May 5, 2026

As mentioned in discussion #2458 further improvement on this library is stalled as there are not enough automated tests to prevent regressions when reviewing PRs.

A foundation to improve on tests is to run tests with code coverage collected in order to detect yet untested parts of the code and improve the overall test quantity (yes, coverage is not a quality indicator...)

You can run the tests with coverage by npm run test:coverage. Once the tests are done, the coverage is a) printed to the terminal and b) saved in various formats in the (git-ignored) coverage folder.

No current tests were rewritten or changed.

An initial run on my local machine:

npm run test:coverage

> sortablejs@1.15.7 test:coverage
> node ./scripts/coverage.js

Coverage data written to /home/jankapunkt/dev/leaonline/libnpm/Sortable/.nyc_output/coverage.json
-------------|---------|----------|---------|---------|----------------------------------------------------------------------------
File         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                                                          
-------------|---------|----------|---------|---------|----------------------------------------------------------------------------
All files    |    9.38 |     5.31 |   12.86 |    9.47 |                                                                            
 Sortable.js |    9.38 |     5.31 |   12.86 |    9.47 | ...1-2669,2680-2685,2702-2749,2755-2773,2799,2812-2820,2828-3254,3267-3361 
-------------|---------|----------|---------|---------|----------------------------------------------------------------------------

@jankapunkt
Copy link
Copy Markdown
Author

Is the CI broken or something?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant