diff --git a/Dockerfile b/Dockerfile index e312007..c056b28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM node:0.10-slim +FROM node:10.3.0-alpine +RUN npm config set unsafe-perm true RUN npm install -g mocha -RUN npm install -g istanbul RUN npm install -g gulp COPY ./package.json /src/package.json @@ -9,7 +9,5 @@ RUN cd /src && npm install COPY ./ /src WORKDIR /src -#ENV DEBUG=* - CMD ["npm", "start"] diff --git a/app/tests/room.unit.spec.js b/app/tests/room.unit.spec.js index 580434e..bccd9fd 100644 --- a/app/tests/room.unit.spec.js +++ b/app/tests/room.unit.spec.js @@ -2,4 +2,7 @@ describe('entity tests', function(){ it('create user', function(done){ done(); }) + it('should ', (done) => { + done() + }); }) diff --git a/app/tests/test.spec.js b/app/tests/test.spec.js new file mode 100644 index 0000000..9fde97e --- /dev/null +++ b/app/tests/test.spec.js @@ -0,0 +1,5 @@ +describe('test', function(){ + it('test ', (done) => { + done() + }); +}) diff --git a/coverage/index.html b/coverage/index.html new file mode 100644 index 0000000..3b4c6b2 --- /dev/null +++ b/coverage/index.html @@ -0,0 +1,10 @@ + + + + + Title + + +

Report

+ + \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 09e6781..c0d0dc9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ - #this is an example of a self-hosted chat app. #the composition uses just mongo as a database and an image that was built from a demo application https://github.com/containers101/demochat diff --git a/gulpfile.js b/gulpfile.js index d441313..ef52e12 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,24 +1,24 @@ var gulp = require('gulp'); -var istanbul = require('gulp-istanbul'); +// var istanbul = require('gulp-istanbul'); // We'll use mocha in this example, but any test framework will work var mocha = require('gulp-mocha'); var debug = require('gulp-debug'); -gulp.task('pre-test', function () { - return gulp.src(['app/**/*.js','!app/tests/**/*.spec.js']) +/*gulp.task('pre-test', function () { + return gulp.src(['app/!**!/!*.js','!app/tests/!**!/!*.spec.js']) // Covering files .pipe(istanbul()) // Force `require` to return covered files .pipe(istanbul.hookRequire()); -}); +});*/ -gulp.task('test', ['pre-test'], function () { +gulp.task('test', function () { console.log('test task') return gulp.src(['app/tests/*.js']) - .pipe(debug({title: 'unicorn:'})) - .pipe(mocha({timeout:10000})) + // .pipe(debug({title: 'unicorn:'})) + .pipe(mocha({ timeout:10000, reporter: 'mocha-allure-reporter' })) // mocha-allure-reporter , mochawesome // Creating the reports after tests ran - .pipe(istanbul.writeReports()) + // .pipe(istanbul.writeReports()) // Enforce a coverage of at least 90% //.pipe(istanbul.enforceThresholds({ thresholds: { global: 20} })); }); diff --git a/package.json b/package.json index 64296ce..ff367b3 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "stop": "pkill --signal SIGINT letschat", "prestart": "migroose", "migrate": "migroose", - "test": "mocha ./app/tests" + "test": "gulp test" }, "engine": { "node": "0.10.x", @@ -80,6 +80,7 @@ "md5": "^2.0.0", "migroose": "^0.5.0", "migroose-cli": "^0.1.0", + "mocha-allure-reporter": "^1.4.0", "moment": "^2.10.6", "mongoose": "~4.1.8", "mongoose-unique-validator": "~0.4.1", @@ -89,6 +90,7 @@ "node-xmpp-server": "2.1.0", "node_hash": "^0.2.0", "nunjucks": "^1.3.4", + "nyc": "^13.1.0", "on-finished": "^2.3.0", "passport": "0.2.2", "passport-http": "0.2.2", @@ -109,6 +111,7 @@ "gulp-mocha": "^2.2.0", "istanbul": "^0.4.2", "mocha": "^2.3.4", + "mochawesome": "^3.0.3", "shortid": "^2.2.4" } }