Added jasmine-based testing harness.

This patch adds jasmine-based testing harnesses for node tests.
A dummy test has also been added to demonstrate use of ES6
features.

Change-Id: I6d7249ba0224107f79a453eff0676e1c49424eb6
This commit is contained in:
Michael Krotscheck 2016-06-26 14:37:38 -07:00 committed by Vitaly Kramskikh
parent effd5b100c
commit 9877477cef
5 changed files with 27 additions and 2 deletions

View File

@ -4,3 +4,4 @@ node_modules
npm-debug.log
package
doc
cover

View File

@ -4,8 +4,7 @@
"description": "JavaScript API library for OpenStack.",
"main": "dist/index.js",
"scripts": {
"pretest": "npm run build",
"test": "exit 0",
"test": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json",
"lint": "eslint ./",
"prepublish": "nsp check; npm run build",
"build": "babel src -d dist",
@ -32,6 +31,7 @@
"babel-register": "^6.9.0",
"eslint": "^2.4.0",
"eslint-config-openstack": "2.0.0",
"jasmine": "^2.4.1",
"nsp": "^2.4.0"
},
"files": [

View File

@ -2,3 +2,8 @@ import 'babel-polyfill';
import log from 'loglevel';
log.setLevel('INFO');
export default class Test {
constructor() {
}
}

8
test/unit/indexTest.js Normal file
View File

@ -0,0 +1,8 @@
import Test from "../../src/index.js";
describe("Simple test", () => {
it("should export a class", () => {
var t = new Test();
expect(t).toBeDefined();
});
});

11
test/unit/jasmine.json Normal file
View File

@ -0,0 +1,11 @@
{
"spec_dir": "test/unit",
"spec_files": [
"**/*[tT]est.js"
],
"helpers": [
"../../node_modules/babel-register/lib/node.js"
],
"stopSpecOnExpectationFailure": false,
"random": false
}