#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('account login()', () => {
describe('when credentials are correct', () => { 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()', () => { describe('account logout()', () => {
it('should logout and remove token after valid login', async() => { it('should logout and remove token after valid login', async() => {

View File

@ -61,16 +61,14 @@ backOnly.description = `Starts backend service`;
// backend tests // backend tests
function backTestOnly() { function backendUnitTest() {
serviceRoot = 'vn-loopback';
let app = require(`./loopback/server/server`); let app = require(`./loopback/server/server`);
let specFiles = [ let specFiles = [
`./back/**/*.spec.js`, 'back/**/*.spec.js',
`./loopback/**/*.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 jasmine = require('gulp-jasmine');
const reporters = require('jasmine-reporters'); const reporters = require('jasmine-reporters');
@ -85,16 +83,22 @@ function backTestOnly() {
app.disconnect(); 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); const dockerAndBackTest = gulp.series(docker, backendUnitTest);
backendTest.description = `Restarts database and runs the backend tests`; dockerAndBackTest.description = `Restarts database and runs the backend tests`;
const backTest = gulp.parallel(backendTest, done => { function backTest(done) {
gulp.watch('modules', gulp.series(backendTest)); const nodemon = require('gulp-nodemon');
done();
}); nodemon({
backTest.description = `Watches for changes in modules to execute backendTest task`; 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 // end to end tests
@ -477,7 +481,8 @@ module.exports = {
front, front,
back, back,
backOnly, backOnly,
backTestOnly, backendUnitTest,
dockerAndBackTest,
backTest, backTest,
e2eOnly, e2eOnly,
e2e, e2e,