starting to work on JSVerify & Mocha based unit tests for our JS code base

This commit is contained in:
El RIDO
2017-01-29 14:31:44 +01:00
parent 8029c2819f
commit fdef8bc5be
6 changed files with 133 additions and 7 deletions

View File

@@ -1,20 +1,56 @@
Running unit tests
==================
Running PHP unit tests
======================
In order to run these tests, you will need to install the following packages
and its dependencies:
* phpunit
* php-gd
* php-sqlite3
* php-xdebug
* php-xdebug (for code coverage reports)
Example for Debian and Ubuntu:
```sh
$ sudo aptitude install phpunit php-gd php-sqlite php-xdebug
```console
$ sudo apt install phpunit php-gd php-sqlite php-xdebug
```
To run the tests, just change into this directory and run phpunit:
```sh
```console
$ cd PrivateBin/tst
$ phpunit
```
Running JavaScript unit tests
=============================
In order to run these tests, you will need to install the following packages
and its dependencies:
* npm
Then you can use the node package manager to install the latest stable release
of mocha and istanbul (for code coverage reports) globally and jsVerify, jsdom
and jsdom-global locally:
```console
$ npm install -g mocha istanbul
$ cd PrivateBin/js
$ npm install jsverify jsdom jsdom-global
```
Example for Debian and Ubuntu, including steps to allow current user to install
node modules globally:
```console
$ sudo apt install npm
$ sudo mkdir /usr/local/lib/node_modules
$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
$ ln -s /usr/bin/nodejs /usr/local/bin/node
$ npm install -g mocha istanbul
$ cd PrivateBin/js
$ npm install jsverify jsdom jsdom-global
```
To run the tests, just change into the `js` directory and run istanbul:
```console
$ cd PrivateBin/js
$ istanbul cover _mocha
```

View File

@@ -13,7 +13,7 @@
</filter>
<logging>
<log type="coverage-clover" target="log/coverage-clover.xml" />
<log type="coverage-html" target="log/coverage-report" charset="UTF-8" yui="true" highlight="true" lowUpperBound="50" highLowerBound="80" />
<log type="coverage-html" target="log/php-coverage-report" charset="UTF-8" yui="true" highlight="true" lowUpperBound="50" highLowerBound="80" />
<log type="testdox-html" target="log/testdox.html" />
</logging>
</phpunit>