#1042 gulp backTest fixed

This commit is contained in:
Carlos Jimenez Ruiz 2019-01-24 12:01:35 +01:00
parent 366527d87e
commit f9c79241ae
3 changed files with 22 additions and 17 deletions

View File

@ -1,4 +1,4 @@
const app = require(`${serviceRoot}/server/server`);
const app = require('vn-loopback/server/server');
describe('account login()', () => {
describe('when credentials are correct', () => {

View File

@ -1,4 +1,4 @@
const app = require(`${serviceRoot}/server/server`);
const app = require('vn-loopback/server/server');
describe('account logout()', () => {
it('should logout and remove token after valid login', async() => {

View File

@ -61,16 +61,14 @@ backOnly.description = `Starts backend service`;
// backend tests
function backTestOnly() {
serviceRoot = 'vn-loopback';
function backendUnitTest() {
let app = require(`./loopback/server/server`);
let specFiles = [
`./back/**/*.spec.js`,
`./loopback/**/*.spec.js`
'back/**/*.spec.js',
'loopback/**/*.spec.js',
'modules/*/back/**/*.spec.js'
];
for (let mod of modules)
specFiles.push(`./modules/${mod}/back/**/*.spec.js`);
const jasmine = require('gulp-jasmine');
const reporters = require('jasmine-reporters');
@ -85,16 +83,22 @@ function backTestOnly() {
app.disconnect();
});
}
backTestOnly.description = `Runs the backend tests only, can receive args --junit or -j to save reports on a xml file`;
backendUnitTest.description = `Runs the backend tests only, can receive args --junit or -j to save reports on a xml file`;
const backendTest = gulp.series(docker, backTestOnly);
backendTest.description = `Restarts database and runs the backend tests`;
const dockerAndBackTest = gulp.series(docker, backendUnitTest);
dockerAndBackTest.description = `Restarts database and runs the backend tests`;
const backTest = gulp.parallel(backendTest, done => {
gulp.watch('modules', gulp.series(backendTest));
done();
});
backTest.description = `Watches for changes in modules to execute backendTest task`;
function backTest(done) {
const nodemon = require('gulp-nodemon');
nodemon({
script: 'node_modules/.bin/gulp',
args: ['dockerAndBackTest'],
watch: ['loopback', 'modules/*/back/**', 'back'],
done: done
});
}
backTest.description = `Watches for changes in modules to execute backTest task`;
// end to end tests
@ -477,7 +481,8 @@ module.exports = {
front,
back,
backOnly,
backTestOnly,
backendUnitTest,
dockerAndBackTest,
backTest,
e2eOnly,
e2e,