Comments (2)
This isn't going to happen by v0.6.0. Even the simplified version of coverage I've proposed above is a lot more difficult to implement than I'd anticipated. It's still a feature I'd like to include, but I'm leaving it marked as future, and will hopefully get it included in a future release.
from zunit.
Proposal for coverage reporting
Line-by-line coverage simply isn't possible with ZSH, without some sort of extension to record each one of code as it is read and executed. That's simply beyond my ability at the moment, so here I'm proposing a sort of pseudo code coverage, which records coverage of functions rather than individual lines.
We can record the size of the $functions
array at the start of testing, and then source all included files (in a subshell so the environment is not affected) and then recount $functions
to get the number of functions defined in the project. We can then grep the output of zprof
after each test to determine which functions were called by the test, and mark them as covered. Similarly to other languages, to avoid all called functions being marked as covered, we can set which functions are covered within the test. Example syntax:
@test 'My awesome test' {
@covers _my_awesome_function
# test code here...
}
This would only mark _my_awesome_function
as covered if it is called, and will not affect coverage of any other function. Similarly, if _my_awesome_function
is not called within the test, it will not be marked as covered.
This is a little bit more vague than proper line-level coverage, but it would be fairly easy to implement and is certainly a lot better than anything we've got in ZSH at the moment.
Since coverage would only be performed with an option or if defined in .zunit.yml
, I should be able to include this in v0.6.0 without any breaking changes.
One day I might look into developing a proper C extension for ZSH to do line coverage, but I'm not a C developer so it's not something I could do at the moment.
from zunit.
Related Issues (20)
- _zunit_run_testfile:21: tests: assignment to invalid subscript range HOT 4
- Feature request: option to copy stderr of run statements to another file / file descriptor HOT 6
- Completely missing steps in setup
- Other installation methods HOT 3
- 'Assertion world does not exist' is not empty HOT 5
- A general question HOT 4
- Better error handling or debug/verbose behavior, please?
- Files in tests directory should be ignored when they lack a .zunit extension
- The homebrew statement "bottle :unneeded" is deprecated and needs to be removed
- [feature] Shell completion HOT 1
- [feature] Support codecov
- Provide a way to run a specific set of test(s) HOT 2
- Add option to run tests asynchronously HOT 1
- Make init --travis idempotent HOT 1
- Better documentation HOT 2
- "Missing required dependency" - Potential Regression in zunit 0.8.2? HOT 4
- Enable config environment variables over .zunit.yml HOT 1
- Unable to get --time-limit option to work (via cli or .yml) HOT 1
- Coding style – uses forks? HOT 6
- Provide option to output JUnit XML
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zunit.