hbenl / vscode-jasmine-test-adapter

Jasmine Test Adapter for the VS Code Test Explorer
MIT License
20 stars 20 forks source link

Calling describe() and it() from external functions shows up incorrectly in test explorer. #53

Closed Atlinx closed 2 years ago

Atlinx commented 2 years ago

For my Jasmine tests, I have a couple of utility functions that automate the creation of test cases (For example a function to create parameterized tests). However, Jasmine doesn't display these tests correctly. I dug into the code and it seems like it's because this adapter relies on getting the file that the describe and it functions are called in -- not the actual test files that they reside. Would it be possible to add a way to disable this behavior so that each describe and it call is linked to the .spec.ts file is currently being inspected by the test explorer?

hbenl commented 2 years ago

I've improved the location detection strategy in version 1.7.3, it now looks for a direct or indirect call to describe or it coming from one of the test files. That should work for your setup (as long as you don't define your utility functions in one of the test files).