diff --git a/core/tests/README.md b/core/tests/README.md
index dfd1154..8da9bd2 100644
--- a/core/tests/README.md
+++ b/core/tests/README.md
@@ -2,6 +2,8 @@
 
 ## Functional tests
 
+First you need to install phantomjs on your system, see http://phantomjs.org/download.html.
+
 * Start PhantomJS:
   ```
   phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
@@ -13,3 +15,24 @@
   ./vendor/bin/phpunit -c core --testsuite functional
   ./vendor/bin/phpunit -c core --testsuite functional-javascript
   ```
+
+## Unit testing
+
+### PHP
+
+./vendor/bin/phpunit -c core --testsuite unit
+
+### Javascript
+
+First you need to install the dependencies using npm, see (Installing NPM)$https://docs.npmjs.com/getting-started/installing-node].
+
+```
+cd core/tests/js
+npm install
+```
+
+Once you have installed it, you can run the tests using
+
+```
+node_modules/mocha/bin/mocha
+```
diff --git a/core/tests/js/execfile.js b/core/tests/js/execfile.js
new file mode 100644
index 0000000..7af1b8b
--- /dev/null
+++ b/core/tests/js/execfile.js
@@ -0,0 +1,8 @@
+var vm = require("vm");
+var fs = require("fs");
+module.exports = function(path, context) {
+  context = context || {};
+  var data = fs.readFileSync(path);
+  vm.runInNewContext(data, context, path);
+  return context;
+}
diff --git a/core/tests/js/package.json b/core/tests/js/package.json
new file mode 100644
index 0000000..d68fc2d
--- /dev/null
+++ b/core/tests/js/package.json
@@ -0,0 +1,16 @@
+{
+  "name": "js",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "chai": "^3.5.0",
+    "mocha": "^2.4.5",
+    "sinon": "^1.17.3"
+  }
+}
diff --git a/core/tests/js/test/states.js b/core/tests/js/test/states.js
new file mode 100644
index 0000000..cc873f8
--- /dev/null
+++ b/core/tests/js/test/states.js
@@ -0,0 +1,23 @@
+var execfile = require("../execfile");
+var sinon = require('sinon');
+var chai = require('chai');
+var assert = chai.assert;
+
+var Drupal = {};
+Drupal.behaviors = {};
+document = null;
+
+$ = sinon.stub();
+$.withArgs(null).returns(sinon.stub({on: function() {} }));
+
+var context = execfile("../../misc/states.js", { jQuery: $, Drupal: Drupal, document: document});
+
+describe('states', function() {
+  describe('states.Dependent.comparisons.Function', function () {
+    var states = context.Drupal.states;
+    assert.isOk(states.Dependent.comparisons.Function(function(a) {
+      return a == 'hello';
+    }, 'hello'));
+  });
+});
+
