hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
38.85k stars 4.76k forks source link

Improve test coverage #3984

Open curbengh opened 4 years ago

curbengh commented 4 years ago

Check List

Please check followings before submitting a new feature request.

Feature Request

This repo's unit test coverage currently stands at Coverage Status.

For anyone who is interested in improving it, there are a few ways:

  1. Search for "missing-unit-test" to locate functions that haven't been covered.
  2. Click on the coverage badge link and it shows all the relevant lines.
  3. Line coverage report is also shown in the CI job log.

hexo-util Coverage Status also needs help.

seaoak commented 4 years ago

@curbengh Thank you for nice waking-up call!

I checked a "missing-unit-test" point of hexo-util. https://github.com/hexojs/hexo-util/blob/master/test/highlight.spec.js#L172

I found that highlight() of hexo-util might not work well for illegal syntax codes. highlight() of highlightjs package will throw an exception if source text is illegal syntax codes. https://highlightjs.readthedocs.io/en/latest/api.html#highlight-languagename-code-ignore-illegals-continuation

But hexo-util/lib/highlight.js might not consider that case.

I continue to investigate this issue (and make new issue in the repo of hexo-util).

SukkaW commented 3 years ago

After #4422, the coverage has been increased from 97.03% to 98.26%.

stevenjoezhang commented 3 years ago
npx c8 report --reporter=lcov --reporter=text
File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 99.54 96.22 99.14 99.54
box 96.53 95.23 100 96.53
file.ts 100 100 100 100
index.ts 96.02 94.93 100 96.02 ...62,274-276,280-282
extend 100 96.16 100 100
console.ts 100 100 100 100
deployer.ts 100 100 100 100
filter.ts 100 97.5 100 100 71
generator.ts 100 100 100 100
helper.ts 100 100 100 100
index.ts 100 100 100 100
injector.ts 100 92.5 100 100 63,74-79
migrator.ts 100 100 100 100
processor.ts 100 100 100 100
renderer.ts 100 96.55 100 100 5
syntax_highlight.ts 100 62.5 100 100 43,55-57
tag.ts 100 96.92 100 100 120,182
hexo 99.33 96.19 98.94 99.33
default_config.ts 100 100 100 100
index.ts 99.27 95.78 96.15 99.27 330-331,508-510
load_config.ts 100 91.3 100 100 30,47
load_database.ts 100 100 100 100
load_plugins.ts 97.56 94.28 100 97.56 56,75
load_theme_config.ts 100 100 100 100
locals.ts 100 100 100 100
multi_config_path.ts 100 100 100 100
post.ts 99.79 95.74 100 99.79 194
register_models.ts 100 100 100 100
render.ts 96.37 92.59 100 96.37 23-27
router.ts 99.46 96.61 100 99.46 71
scaffold.ts 100 100 100 100
source.ts 100 100 100 100
update_package.ts 100 100 100 100
validate_config.ts 100 100 100 100
models 99.65 92.85 100 99.65
asset.ts 100 100 100 100
cache.ts 100 100 100 100
category.ts 100 84.21 100 100 23,33,62
data.ts 100 100 100 100
index.ts 100 100 100 100
page.ts 100 100 100 100
post.ts 99.11 94.02 100 99.11 106,183
post_asset.ts 100 100 100 100
post_category.ts 100 100 100 100
post_tag.ts 100 100 100 100
tag.ts 100 82.35 100 100 12,17,55
models/types 100 95.34 100 100
moment.ts 100 95.34 100 100 80,85
plugins/console 99.83 96.47 100 99.83
clean.ts 100 100 100 100
config.ts 100 100 100 100
deploy.ts 100 93.75 100 100 41
generate.ts 99.52 94.82 100 99.52 113
index.ts 100 100 100 100
migrate.ts 100 100 100 100
new.ts 100 100 100 100
publish.ts 100 100 100 100
render.ts 100 85.71 100 100 32
plugins/console/list 100 97.05 100 100
category.ts 100 100 100 100
common.ts 100 100 100 100
index.ts 100 100 100 100
page.ts 100 100 100 100
post.ts 100 83.33 100 100 14
route.ts 100 100 100 100
tag.ts 100 100 100 100
plugins/filter 100 100 100 100
index.ts 100 100 100 100
new_post_path.ts 100 100 100 100
post_permalink.ts 100 100 100 100
plugins/filter/after_post_render 100 100 100 100
excerpt.ts 100 100 100 100
external_link.ts 100 100 100 100
index.ts 100 100 100 100
plugins/filter/after_render 100 95.23 100 100
external_link.ts 100 92.3 100 100 11
index.ts 100 100 100 100
meta_generator.ts 100 100 100 100
plugins/filter/before_exit 100 100 100 100
index.ts 100 100 100 100
save_database.ts 100 100 100 100
plugins/filter/before_generate 100 100 100 100
index.ts 100 100 100 100
render_post.ts 100 100 100 100
plugins/filter/before_post_render 100 96.29 100 100
backtick_code_block.ts 100 94.44 100 100 26
index.ts 100 100 100 100
titlecase.ts 100 100 100 100
plugins/filter/template_locals 100 100 100 100
i18n.ts 100 100 100 100
index.ts 100 100 100 100
plugins/generator 100 100 100 100
asset.ts 100 100 100 100
index.ts 100 100 100 100
page.ts 100 100 100 100
post.ts 100 100 100 100
plugins/helper 99.7 96.2 96.2 99.7
css.ts 100 100 100 100
date.ts 100 100 100 100
debug.ts 100 100 100 100
favicon_tag.ts 100 100 100 100
feed_tag.ts 100 100 100 100
format.ts 80 100 62.5 80 6-8
fragment_cache.ts 100 100 100 100
full_url_for.ts 100 100 100 100
gravatar.ts 100 100 100 100
image_tag.ts 100 100 100 100
index.ts 100 100 100 100
is.ts 100 100 100 100
js.ts 100 100 100 100
link_to.ts 100 100 100 100
list_archives.ts 100 97.22 100 100 44
list_categories.ts 100 91.11 100 100 9,53,85-93
list_posts.ts 100 83.33 100 100 29,45-48
list_tags.ts 100 91.89 100 100 10,75,77
mail_to.ts 100 100 100 100
markdown.ts 100 100 100 100
meta_generator.ts 100 100 100 100
number_format.ts 100 92.85 100 100 37
open_graph.ts 99 94.87 100 99 43-44
paginator.ts 100 97.5 100 100 117
partial.ts 100 100 100 100
relative_url.ts 100 100 100 100
render.ts 100 100 100 100
search_form.ts 100 100 100 100
tagcloud.ts 100 95.45 100 100 30,52
toc.ts 100 100 100 100
url_for.ts 100 100 100 100
plugins/highlight 100 92 100 100
highlight.ts 100 92.85 100 100 5
index.ts 100 100 100 100
prism.ts 100 90 100 100 5
plugins/injector 100 100 100 100
index.ts 100 100 100 100
plugins/processor 99.62 96.17 100 99.62
asset.ts 100 100 100 100
common.ts 100 100 100 100
data.ts 100 90 100 100 28
index.ts 100 100 100 100
post.ts 99.32 94.11 100 99.32 233-234
plugins/renderer 95.31 96.96 100 95.31
index.ts 100 100 100 100
json.ts 100 100 100 100
nunjucks.ts 100 100 100 100
plain.ts 100 100 100 100
yaml.ts 72.72 50 100 72.72 11-16
plugins/tag 100 98.17 100 100
asset_img.ts 100 100 100 100
asset_link.ts 100 100 100 100
asset_path.ts 100 100 100 100
blockquote.ts 100 95.45 100 100 26
code.ts 100 96.87 100 100 70
full_url_for.ts 100 100 100 100
iframe.ts 100 100 100 100
img.ts 100 100 100 100
include_code.ts 100 93.33 100 100 43
index.ts 100 100 100 100
link.ts 100 100 100 100
post_link.ts 100 100 100 100
post_path.ts 100 100 100 100
pullquote.ts 100 100 100 100
url_for.ts 100 100 100 100
theme 100 93.75 100 100
index.ts 100 90 100 100 82
view.ts 100 94.73 100 100 10,132
theme/processors 100 96 100 100
config.ts 100 100 100 100
i18n.ts 100 75 100 100 18
source.ts 100 100 100 100
view.ts 100 100 100 100