Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test coverage for plugin functionality #15

Closed
dromse opened this issue Apr 13, 2024 · 7 comments
Closed

Test coverage for plugin functionality #15

dromse opened this issue Apr 13, 2024 · 7 comments
Assignees
Labels
Feature New feature or request
Milestone

Comments

@dromse
Copy link
Owner

dromse commented Apr 13, 2024

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.

@dromse dromse added the Feature New feature or request label Apr 14, 2024
@dromse dromse self-assigned this Apr 14, 2024
@dromse dromse added this to the 1.2.0 milestone Apr 19, 2024
@dromse
Copy link
Owner Author

dromse commented Apr 22, 2024

@dromse dromse pinned this issue Apr 22, 2024
dromse added a commit that referenced this issue Apr 22, 2024
For unit testing I use node native test runner
@dromse
Copy link
Owner Author

dromse commented Apr 22, 2024

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.

@dromse
Copy link
Owner Author

dromse commented Apr 22, 2024

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

image

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

image

@dromse
Copy link
Owner Author

dromse commented Apr 23, 2024

I followed the advice from this comment and downgrade version tsx to 4.2.1 and it starts to work, impressive!
image

dromse added a commit that referenced this issue Apr 23, 2024
@dromse
Copy link
Owner Author

dromse commented Apr 26, 2024

@dromse
Copy link
Owner Author

dromse commented Apr 26, 2024

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.

@dromse
Copy link
Owner Author

dromse commented Apr 27, 2024

I currently don't plan to add e2e functionality to this plugin. So I close this issue.

@dromse dromse closed this as completed Apr 27, 2024
@dromse dromse unpinned this issue Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant