Electron-vue: vue unit and e2e is not avilable

Created on 18 Sep 2016  ·  11Comments  ·  Source: SimulatedGREG/electron-vue

hi

I want to test my apps . this is easy with Webpack template because it is install the needed packages and setup karma config with sample example for unit and e2e tests .

do you have plans for testing scaffold or not ?

thank you for the hard work .

enhancement in-progress

Most helpful comment

Just a quick update everyone. Unit and end-to-end testing is almost available!!! 🎉 You can take a look at the feat/unit-e2e branch now. Here are the docs.

All 11 comments

@alnour-altegani

There currently haven't been any plans to implement unit/e2e testing. I haven't seen a direct need for them until now, so I'll try and get working on this rather soon. It'll be added to the repo project.

thank you .

My latest project also need unit tests, but that does not support. 😭

Just a quick update everyone. Unit and end-to-end testing is almost available!!! 🎉 You can take a look at the feat/unit-e2e branch now. Here are the docs.

if you changed jasmine to mocha for unit testing will be better . this will ease the development for developer and unit the testing tools for unit and e2e tests .


I have a question . what if you required electron module inside vue component and needed to test it . did it run correctly ?
thisi s issue is relative
https://github.com/twolfson/karma-electron/issues/14

@alnour-altegani

I did try using Mocha for unit testing at first, but had some serious issues getting sinon to play nicely on karma@^1.1.0 as karma-electron requires that version. Moved to Jasmine and had far less trouble. But I do see your point and will have to give it another shot with Mocha (with Chai).

As for electron being used inside a Vue component, I have not had any trouble when importing it directly inside the Vue components file. The big issue from here is that since components are being tested individually (outside the scope of main.js), Vue plugins are never installed. So things like this.$electron or this.$http are never defined. I'm hoping to find a work around for this as using this.$electron is far more easier than having to import electron each and every time.

Thanks for your feedback. 😊

UPDATE:
Found that if you DON'T ignore main.js in srcContext at test/unit/index.js plugins become available! This is initially ignored to help coverage reports, but it may be worth removing.

Update

I've been really busy with other things, but will pick this up next week (hopefully this weekend).

can I do any thing to help to finish this feature ?

@alnour-altegani if you really want to help, make a PR with the feature.

@alnour-altegani

After many more attempts, still not getting anywhere with sinon. I'll still be looking into it, but for now unit testing is based on Mocha + Chai. Going to do some more review and testing before pushing to master, but if you want to give it a try now....

vue init simulatedgreg/electron-vue#feat/unit-e2e my-project

Make sure to update vue-cli as a bug was fixed when dealing with branch names that have /'s in them.

Had major delay with CI testing and [email protected] breaking window.open, but all is well now. 😄 🎉

Was this page helpful?
0 / 5 - 0 ratings