-
Notifications
You must be signed in to change notification settings - Fork 62
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 framework to support running single tests #766
Comments
Hey @nocodehummel, thanks for the above feedback and in general for your contributions to the project. I'll note that in the console at least, you can target specific files quite easy, i.e. $ yarn test getCrumb which I think is just a filename glob but could possibly look through test names too, I never actually looked into it further. I'm surprised things like As for your point on In general, the caching approach taken by I would love to eventually rewrite the test code in |
@gadicc thanks for the quick response. |
@nocodehummel, my pleasure, and thanks for all your help with the project :) Sure, that would be amazing! I really do struggle with time for the project, so this kind of help is super appreciated. Having said that, if this particular issue ends up being more work than you expected and you change your mind, please don't worry about it. But otherwise yes, I agree completely; long term maintainability and contributability for the win! 🙏 |
@gadicc, a first test case with the jest-fetch-mock-cache package created an empty cached file upon response with status 307. My assumption was that the file would contain a cached response object. Is this the expected behavior? |
@gadicc I made a minor change to the fetch caching package by saving without header in the file name. |
Hey! Oh wow, you don't waste any time... thanks! 😁 I won't be at my PC most of today but let me try answer briefly before I head out.
Sorry, I think all the dev work I did on the package until now assumed a 200 status, so yes, this looks like an unfortunate bug to discover so early. Your assumption is correct on the expected behaviour, I should have a chance to look at this tomorrow if you don't beat me to it :) We'll add a test case for redirects.
The issue here is that the request headers also affect the response. Case in point, the user-agent for I may not be around again until tomorrow but will check my phone when I can. Thanks again for your efforts here 🙏 |
Feature Request
The test framework should be more flexible and be able to run specific tests independently. Currently it is not possible to run a specific test with
it.only
or using a tool like Jest Runner in VSC.Use Cases
While investigating an issue it is very difficult to make incremental progress and verify the outcome with a test case. This was especially complex related to #764.
The goal would be for developers to be able to contribute to the library with test driven development. Without the support of test cases it is hard to make changes in a complex library. The test cases are the ideal way to trigger specific functions and verify results.
Other
The current approach with
fetchDevel
causes inter-dependencies between actual application modules and test functions. These dependencies cause issues in specific environments (#645) and with loading modules when running a single test.A redesign to use JEST Class Mocks could be a possible solution.
Related topic to this is the use of test data. In principle it should be possible to delete the cached data and than successfully run the tests. This is currently difficult as the cached data is mixed with other (manipulated) test data for specific cases.
I wanted to share my thoughts after spending some time investigating an issue.
The text was updated successfully, but these errors were encountered: