Re: Unit testing under GJS



Hello, I've updated the repository for the extension, Karma is no longer used for testing, jasmine-gjs is used instead. This is even working with Travis CI (although it runs on a pretty dated gjs version, 1.40). Transpiling should now be optional, and testing is a lot let hackish (e.g. you no longer need a full browser implementation like PhantomJS and Karma) and it's running under native GJS.

Webpack is still used, which requires a build step before testing to generate a single test UMD module. This makes executing a single test file impossible right now, they all have to be executed at once.

Using Andrea's cgjs, webpack can be avoided, it'll make all NPM modules available in a more native way. Also, tests can be run individually, which is an added benefit.

Next step would be to give cgjs a try to use require instead of the native imports mechanism of GJS.

Regards.


On 04/12/17 20:02, Edgar Merino wrote:

Hello Andrea, CGJS looks promising, it actually solves what I was missing/patching, and it can be easily integrated with WebPack (which in turn provides ES6 imports through UMD, if needed/preferred).

To eliminate transpiling completly when testing, currently you can use firefox, but a better option would be something like jasmine-gjs. I'll give this a try and report back, this should also eliminate the dependency on Karma, which is mostly a hack here, but there's got to be some work done to integrate that with webpack (needed mostly for ES6 imports).

I'll see if plugin-transform-builtin-classes helps, thanks for the tip!

Regards.


On 04/12/17 19:15, Andrea Giammarchi wrote:
Babel transpiling builtins is broken since ever: https://github.com/babel/babel/issues/4480


Also please have a look at cgjs which brings CommonJS to GJS:

Regards

On Mon, Dec 4, 2017 at 8:45 PM, Sriram Ramkrishna <sri ramkrishna me> wrote:
I'm going to defer to someone like Phillip Chimento who knows this stuff way better than I do.  However..


On Mon, Dec 4, 2017 at 2:54 PM Edgar Merino <donvodka gmail com> wrote:
    I've posted a similar email to the GSE mailing list, but I thought it would be helpful for any GJS developer looking to create quality code by applying TDD.

It'll be great to read your thoughts on this approach.



Thank you for putting the effort into doing this.  This is pretty neat concept.  At one point, a couple years ago I was trying to figure out how to do testing on extensions as a whole as part of the release process.  The test was a basic "Does it work?".  But having a mechanism to do unit tests would be pretty handy especially if it could be incorporated as part of the submission process.  So from a policy perspective I think this is pretty awesome.

sri


_______________________________________________
_javascript_-list mailing list
_javascript_-list gnome org
https://mail.gnome.org/mailman/listinfo/_javascript_-list






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]