Django, now with JavaScript tests
docs.djangoproject.com
docs.djangoproject.com
I'm currently using pytest-splinter with phantomjs2, everything works quite well, but I had issues with simulating clicks (I'm still at an early stage of exploration, it could be my fault).
Any similar experiences?
It handles a lot of the boilerplate for running services like django, celery, postgres, etc. as well as getting selenium up and running with firefox so that you can simulate clicks and stuff and a mock SMTP server so that you can simulate sending emails.
>I like how you've added the option to 'time travel' and check for example if a reminder mail is being send correctly.
Yes, those two things are a large part of why I wrote it.
I wanted a clean integration with libfaketime and I wanted to be able to create simple mock services that logged out JSON that the test could wait for with epoll, parse and use to verify that the event interaction occurred (e.g. email got received by SMTP gateway/API call was made).
I wrote this Python client which facilitates basic JS integration testing.
I guess the audience of the JS tests mostly consists of jQuery users, so it's probably not as strange as it seems to an outsider.
I wonder whether there are any reliable stats on test framework popularity in the wider JS community. The only numbers I've seen suggest that it's mostly Mocha and Jasmine.
Haven't found an instance of Mocha. Most job postings I've seen indicate that Jasmine is the dominant test framework.
Basically an old 1.x version of Jasmine, bolted to a test runner, a JSDom environment, and a ton of mostly working automocking magic. It's glacially slow and kind of buggy, and in my experience most projects using React use Mocha, not Jest. And I haven't run across any using actual Jasmine (Jasmine and Jest are neither compatible nor interchangable).
As a general rule, I'd say node-based projects are heavily mocha based, whereas browser-based projects are much more mixed. CoffeeScript based projects seem especially likely to use Mocha over Jasmine; Angular (as you noted) has a strong preference for Jasmine due to their Protractor tool, etc. QUnit seems to be used by a lot of libraries and frameworks, but to have almost no usage among projects; I've never seen QUnit tests in the wild except in framework/library repos.
And as a final data point, note that on NPM, the main mocha package has almost 5 times the weekly downloads of the main jasmine package.
It was extremely straightforward to integrate with Mocha, though. We just needed to stub out some of the node.js-specific code and provide a very small wrapper to provide our own module loader and reporting plugins. There is an active effort to split up Mocha into multiple modules in order to make it more portable, which would make the stubbing unnecessary, too.
For a bit of background, DEPs are a bit of an experiment at the moment to try and flesh out discussions for changes and improvements that might not have a clear cut answer.
Also EditorConfig and JSHint, good on them.
> Behind the scenes, compress.py is a front-end for Google’s Closure Compiler which is written in Java. However, the Closure Compiler library is not bundled with Django directly, so those wishing to contribute complete JavaScript patches will need to download and install the library independently. The Closure Compiler library requires Java 7 or higher.
Why Java? Why Clojure?
How did the core team of django come to the conclusion that Java should be apart of the stack?
Pretty simple, really
Not Clojure, the Lisp dialect. Closure is a JavaScript dialect invented by Google with some niceties added. They seem to be using their minifier.
If you are running Eclipse, you already have a Java runtime somewhere in your machine anyway.