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

Dynamic test cases raises 'Test file path not found' log message #18

Open
mesche opened this issue Aug 12, 2019 · 7 comments
Open

Dynamic test cases raises 'Test file path not found' log message #18

mesche opened this issue Aug 12, 2019 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@mesche
Copy link

mesche commented Aug 12, 2019

Currently, path-finder raises an error log message, when creating dynamic test cases with forEach.

['a', 'b', 'c']
.forEach((item: any) => {
it('testcase_' +item, () => {
console.log(item);
});
});

@fadc80
Copy link
Owner

fadc80 commented Aug 13, 2019

Yeap! This is a limitation of the approach used to detect test file paths.

Karma doesn't report them as part of test metadata, but this information is required by sonarqube.

Actually, pathFinder tries to look for test file paths using regular expressions based on "describe" and "it" comments.

In your example you generate tests dynamically. Consequently, pathFinder is trying to find test files containing:

  • testcase_a
  • testcase_b
  • testcase_c

However, there aren't any test files containing this comments.

I think a solution would require changing the approach to something like suggested here.

@mesche
Copy link
Author

mesche commented Aug 13, 2019

Thank you for your feedback. I understand the problem, but other libraries like 'karma-sonarqube-unit-reporter' have no problem with that. I like your library and would like to use it furthermore. is it planned to fix/change the behavior?

@fadc80
Copy link
Owner

fadc80 commented Aug 13, 2019

Sure. I'll try to look at this during the next weekend!

@fadc80
Copy link
Owner

fadc80 commented Oct 5, 2019

I tried very hard to solve this but without success. As I mentioned before, I decided to change the approach based on what is suggested here. However, it didn't work as I expected. Check my comments there.

@mesche Are you sure 'karma-sonarqube-unit-reporter' has no problem with this? I didn't test it, but I was unable to see reading its code how this case is handled. It seems to be using regular expressions too.

@fadc80 fadc80 added the help wanted Extra attention is needed label Oct 5, 2019
@mesche
Copy link
Author

mesche commented Oct 7, 2019

@fadc80 Yes, I am sure

@fadc80
Copy link
Owner

fadc80 commented Nov 30, 2019

@all-contributors please add @mesche as a contributor for bug.

@allcontributors
Copy link
Contributor

@fadc80

I've put up a pull request to add @mesche! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants