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
Add DEP: JavaScript Tests #4
Conversation
|
||
-- Jacob Kaplan-Moss | ||
|
||
Django admin and gis contrib packages contain JavaScript code without any unit tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most JavaScript in Django is tested through Selenium, it's far from ideal but it's something, this statement needs to be revisited IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Selenium tests are high-level functional/integration tests, not unit tests. Unit tests run much more quickly and test the JS API rather than the in-browser behavior of the JS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, but this posted right below "Code without tests is broken as designed." seems to imply that Django's JS is untested, that's not the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it would be good to clarify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@loic good point. I am making a guess (albeit one with good odds) that portions of the JavaScript code are not executed.
I've noticed in my own code that JavaScript tests often require more mocking than Python code because of the event-driven nature of JS. So my guess about the lacking nature of the existing tests may not be far from reality, but it's hard to tell for sure without a code coverage tool in place.
I should also note sinon for mocking and a code coverage tool (probably istanbul unless we use karma).
Changes:
|
We are trying to get the DEP process started again. Could you squash the commits into one? After that we can merge the proposal to drafts. |
f715dfa
to
202e2d4
Compare
@akaariai commits squashed. Thanks for restarting the process. |
This is a rough draft for a DEP detailing a path to adding JavaScript unit tests to Django.
This proposal currently only details my recommendation for a test suite and a native JS testing process (without a Python wrapper), including my reasoning.
I have also included some open questions that still need to be addressed.
Related django-developers mailing list thread