Setup Karma JS test suite for ownCloud on Kubuntu 15.04Submitted by blizzz
First, it requires Node.js. They can be installed right out from the repositories. As I read somewhere, more recent versions are available on some PPA, but this one is sufficient. npm is its package manager.
sudo apt install nodejs npm
sudo apt install nodejs nodejs-legacy npm
The nodejs-legacy package provides the symlink, so you don't need to mess around manually in /usr/bin. Thus the following step is obsolute. Thanks to Felix for the hint.
First obstacle: because of a hard coded path somewhere, npm would not be able to find node. A symlink helps:
sudo ln -s /usr/bin/nodejs /usr/bin/node
Afterwards, we need the karma test suite and the modules which are used by ownCloud. They are installed using npm. You will notice the -g flag, which stands stands for global. If you leave it, the stuff will be installed into the local directory. One time I forget the flag and spent hours figuring out why it is not working. However, this step is supposed to be optional as the autotest script we will run eventually should take care of this. For unknown reasons it did not work for me, so I executed this steps manually once.
sudo npm install -g karma
sudo npm install -g karma-jasmine
sudo npm install -g karma-junit-reporter
sudo npm install -g karma-coverage
sudo npm install -g karma-phantomjs-launcher
That's all. Finally you can cd into your git clone of ownCloud and let the autotest script do all the JS tests:
There is one minor flaw. I was too lazy too "You must set an output directory for JUnitReporter via the outputDir config property" so the JUnitReporter does not work. It does not matter to me at all, the output shows me whether tests succeed or which fail.
There is actually a package
There is actually a package to create that symlink (if you don't like messing around with /usr/bin like I do): sudo apt-get install nodejs-legacy
Very good hint! Essentially
Very good hint! Essentially it does the same, but I agree having that symlink in /usr/bin from a package is preferable. I will update the post.
Add new comment