Closed dromse closed 2 months ago
For unit tests I consider to use Test runner | Node.js v21.7.3 Documentation. For e2e I'm currently in active-searching what to use.
I discovered that Native Test Runner doesn't provide check test coverage for all project, just only for used files in tests.
From my perspective I think it would be useful to get test coverage from all project {.ts,.tsx}
files, therefore I want to find utils to get code coverage using Native Test Runner, if it doesn't not exist or this cannot be provided with current Test Runner support I will prefer to switch to another testing library.
I discovered that I can get report from all project by using c8: bcoe/c8: output coverage reports using Node.js' built in coverage
Edit: But I have an issue using it with typescript, I use tsx
method from this comment.
I run
// in scripts
"test": "node --import tsx --test tests/**/*.ts",
"test:coverage": "c8 pnpm test".
And run
pnpm test:coverage
I'm almost there but the problem is that it shows full code coverage, but that's wrong!
// Added `--experimental-test-coverage`
"test": "node --import tsx --experimental-test-coverage --test tests/**/*.ts",
And run
pnpm test
I followed the advice from this comment and downgrade version tsx
to 4.2.1
and it starts to work, impressive!
Now I want to add some e2e tests, What I found for it:
I installed webdriverio and attempt to run an example test but there are conflict between chromedirvers 124 (from electron or webdriverio) and 120 from obsidian. I installed 120 version of chromedriver from here. But I cannot figure out how to proper set up it inside capabilities in wdio.conf.ts.
I currently don't plan to add e2e functionality to this plugin. So I close this issue.
It will be good insight to add tests, because releasing everytime when found new bug and trying to review all code to find bug before releasing is overwhelming.
So this issue is dedicated to search good test framework and list of tests for plugin.