melink14 / rikaikun

rikaikun is a Chrome extension that helps you to read Japanese web pages by showing the reading and English definition of Japanese words when you hover over them.
https://chrome.google.com/webstore/detail/rikaikun/jipdnfibhldikgcjhfnomkfpcebammhp
GNU General Public License v3.0
417 stars 80 forks source link

Add mutation testing framework to rikaikun #571

Open melink14 opened 3 years ago

melink14 commented 3 years ago

Mutation testing is a great way to ensure testing coverage.

For JS it seems only stryker-js exists: https://stryker-mutator.io/docs/stryker-js/getting-started

It can work with karma and typescript and has a dashboard that it can add to your github repo.

Ideally, we'd get incremental reports on Pull Requests but not sure stryker supports that. I guess a dashboard would give a overall score but probably won't want to run it until incremental support works: https://github.com/stryker-mutator/stryker-js/issues/2753

melink14 commented 3 years ago

Incremental workaround for pull requests is mentioned here: https://github.com/stryker-mutator/stryker-js/issues/2843

npx stryker run --mutate $(git diff --name-only HEAD $(git merge-base HEAD origin/main) -- "*.ts" ":(exclude)*.spec.ts" | tr '\n' ',' | sed 's/,$//')

melink14 commented 2 years ago

https://dev.to/igomezal/setting-up-mutation-testing-with-stryker-and-web-test-runner-3c9p is a web test runner guide which seemed to work.

melink14 commented 2 years ago

Using the command runner has some problems since it has no coverage or test knowledge.

melink14 commented 2 years ago

Could create a plugin but it seems complicated. :D

melink14 commented 2 years ago

https://unix.stackexchange.com/questions/582559/is-there-any-better-way-to-filter-the-output-of-git-diff/582649#582649

git magic