Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPII-2515: Add code coverage reporting... #94

Merged
merged 12 commits into from
May 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ gpii/node_modules/gsettingsBridge/nodegsettings/build/
gpii/node_modules/packagekit/nodepackagekit/build/
gpii/node_modules/xrandr/nodexrandr/build/
/node_modules/
coverage
14 changes: 14 additions & 0 deletions .istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# A common istanbul configuration file. Avoids generating reports, as we are collecting data from various runs, and
# will do that as a "posttest" step. You must explicitly generate a report and summary, see the package.json for an
# example command.
instrumentation:
root: .
include-pid: true
default-excludes: false
excludes: ["tests/**", "coverage/**", "instrumented/**", "node_modules/**"]
complete-copy: true
reporting:
dir: ./coverage
print: none
reports:
- none
20 changes: 1 addition & 19 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ GPII Linux Personalization Framework Node.js Bootstrap

Copyright 2014 RTF-US
Copyright 2014 Emergya
Copyright 2017 Raising the Floor International

Licensed under the New BSD license. You may not use this file except in
compliance with this License.
Expand Down Expand Up @@ -78,12 +79,6 @@ module.exports = function (grunt) {
"sudo rm -f /usr/share/applications/gpii-usb-user-listener.desktop",
"sudo rm -f -r /var/lib/gpii"
].join("&&")
},
runAcceptanceTests: {
command: "vagrant ssh -c 'DISPLAY=:0 node /home/vagrant/sync/tests/AcceptanceTests.js'"
},
runUnitTests: {
command: "vagrant ssh -c 'cd /home/vagrant/sync/tests/; DISPLAY=:0 ./UnitTests.sh'"
}
}
});
Expand Down Expand Up @@ -119,17 +114,4 @@ module.exports = function (grunt) {
grunt.registerTask("uninstall", "Uninstall system level GPII Components", function () {
grunt.task.run("shell:uninstallUsbLib");
});

grunt.registerTask("unit-tests", "Run GPII unit tests", function () {
grunt.task.run("shell:runUnitTests");
});

grunt.registerTask("acceptance-tests", "Run GPII acceptance tests", function () {
grunt.task.run("shell:runAcceptanceTests");
});

grunt.registerTask("tests", "Run GPII unit and acceptance tests", function () {
grunt.task.run("shell:runUnitTests");
grunt.task.run("shell:runAcceptanceTests");
});
};
47 changes: 38 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# GNU/Linux

This repository contains all of the platform-specific code required to run the GPII Personalization Framework on GNU/Linux with GNOME.
This repository contains all of the platform-specific code required to run the GPII Personalization Framework on
GNU/Linux with GNOME.

The following components can be found in the repository:

Expand Down Expand Up @@ -51,7 +52,9 @@ this may prompt you for sudo access.

# Setting Up a Virtual Machine

This repository contains content that will allow you to automatically provision a development VM. A [Vagrantfile](http://docs.vagrantup.com/v2/vagrantfile/) is provided that downloads a [Fedora Vagrant box](https://github.com/idi-ops/packer-fedora), starts a VM, and deploys the GPII Framework on it.
This repository contains content that will allow you to automatically provision a development VM. A
[Vagrantfile](http://docs.vagrantup.com/v2/vagrantfile/) is provided that downloads a
[Fedora Vagrant box](https://github.com/idi-ops/packer-fedora), starts a VM, and deploys the GPII Framework on it.

The ``provisioning`` directory contains these files:

Expand All @@ -61,25 +64,51 @@ The ``provisioning`` directory contains these files:

## Requirements

Please ensure that the [QI Development Environments software requirements](https://github.com/GPII/qi-development-environments/blob/master/README.md#requirements) have been met. You will additionally need the following on your host operating system:
Please ensure that the
[QI Development Environments software requirements](https://github.com/GPII/qi-development-environments/blob/master/README.md#requirements)
have been met. You will additionally need the following on your host operating system:

* [grunt-cli](https://github.com/gruntjs/grunt-cli)
* At least 2GB of available storage space

## Getting Started
## Creating a VM

In order to create a new VM you will need to issue the following command:

vagrant up

By default the VM will use two processor cores and 2GB of RAM. Two environment variables can be passed to the ``vagrant up`` command to allocate more cores (``VM_CPUS=2``) and RAM (``VM_RAM=2048``). If this is your first time setting up this VM then the 2GB Fedora Vagrant box will be downloaded.
By default the VM will use two processor cores and 2GB of RAM. Two environment variables can be passed to the
``vagrant up`` command to allocate more cores (``VM_CPUS=2``) and RAM (``VM_RAM=2048``). If this is your first time
setting up this VM then the 2GB Fedora Vagrant box will be downloaded.

Once the box has been downloaded the provisioning process will ensure that project dependencies have been met and then the ``npm install`` and ``grunt --force build`` commands will be executed. If you reboot the VM the provisioner will not run again. However, you can use ``vagrant provision`` to trigger that process at any time.

To run tests you can use the ``grunt tests`` command on your host which will run unit and acceptance tests in the VM. Or you could use ``grunt unit-tests`` and/or ``grunt acceptance-tests`` separately.
Once the box has been downloaded the provisioning process will ensure that project dependencies have been met and then
the ``npm install`` and ``grunt --force build`` commands will be executed. If you reboot the VM the provisioner will not
run again. However, you can use ``vagrant provision`` to trigger that process at any time.

You can stop the VM using ``vagrant halt`` or delete it altogether using ``vagrant destroy``.

## Running Tests in the VM

To run tests on the VM from the host machine, you can use the following commands:

* ``npm run test:vagrant`` - Run all tests on the VM.
* ``npm run test:vagrantUnit`` - Run just the unit tests on the VM.
* ``npm run test:vagrantAcceptance`` - Run just the acceptance tests on the VM.

You can also connect to the VM using the ``vagrant ssh`` command, and run the tests using one of the following commands:

* ``npm test`` - Run all tests.
* ``npm run test:unit`` - Run all unit tests.
* ``npm run test:acceptance`` - Run the acceptance tests.

## Coverage Reporting

If you run the full suite of tests, a code coverage report will be generated in `coverage/lcov-report`, which can be
viewed with a browser. A summary of this report will be output to the console as well.

## Notes

The entire Git working directory will be mounted at the ``/home/vagrant/sync`` path in the VM and bidirectionally synced with the host operating system. This means build artifacts created by processes in the VM will be exposed to the host. It will be safer if you commit to running build tasks such as ``npm install`` or ``grunt build`` in the VM and not attempt that on the host.
The entire Git working directory will be mounted at the ``/home/vagrant/sync`` path in the VM and bidirectionally synced
with the host operating system. This means build artifacts created by processes in the VM will be exposed to the host.
It will be safer if you commit to running build tasks such as ``npm install`` or ``grunt build`` in the VM and not
attempt that on the host.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions gpii/node_modules/gsettingsBridge/tests/gsettingsTests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions gpii/node_modules/gsettingsBridge/tests/scripts/posttest.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading