server-side unit tests env setup

This commit is contained in:
Carlos 2017-09-08 14:37:55 +02:00
parent 8cad612a59
commit 9c80cd8466
5 changed files with 51 additions and 1 deletions

View File

@ -35,9 +35,12 @@ gulp services
## Running the tests
for unit tests run from project's root:
for client-side unit tests run from project's root:
karma start
for server-side unit tests run from project's root:
./test_services.sh
### Break down into end to end tests
comming soon.

View File

@ -44,6 +44,7 @@
"gulp-yaml": "^1.0.1",
"html-loader": "^0.4.4",
"jasmine": "^2.7.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.0.1",
@ -52,6 +53,7 @@
"karma-webpack": "^2.0.4",
"merge-stream": "^1.0.1",
"node-sass": "^3.11.0",
"nodemon": "^1.12.0",
"pre-commit": "^1.1.3",
"raw-loader": "*",
"sass-loader": "^4.0.2",

View File

@ -0,0 +1,5 @@
describe('description', () => {
it('should ...', () => {
expect(true).toBe(true);
});
});

39
services_tests.js Normal file
View File

@ -0,0 +1,39 @@
require('babel-core/register')({presets: ['es2015']});
// process.on('warning', warning => {
// console.log(warning.name);
// console.log(warning.message);
// console.log(warning.stack);
// });
var verbose = false;
if (process.argv[2] === '--v') {
verbose = true;
}
var Jasmine = require('jasmine');
var jasmine = new Jasmine();
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
jasmine.loadConfig({
spec_dir: 'services/',
spec_files: [
'**/specs/*[sS]pec.js'
],
helpers: [
// to implement
// '/api/utils/jasmineHelpers.js'
]
});
jasmine.addReporter(new SpecReporter({
spec: {
// displayStacktrace: 'summary',
displaySuccessful: verbose,
displayFailedSpec: true,
displaySpecDuration: true
}
}));
jasmine.execute();

1
test_services.sh Executable file
View File

@ -0,0 +1 @@
nodemon -q services_tests.js -w services