gulp-jasmine replaced by jasmine
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b0f70c728e
commit
833addcb75
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"verbose": true,
|
||||||
|
"watch": [
|
||||||
|
"back/**/*.js",
|
||||||
|
"modules/**/*.js"
|
||||||
|
],
|
||||||
|
"ignore": [
|
||||||
|
"modules/account/front/**/*",
|
||||||
|
"modules/claim/front/**/*",
|
||||||
|
"modules/client/front/**/*",
|
||||||
|
"modules/entry/front/**/*",
|
||||||
|
"modules/invoiceIn/front/**/*",
|
||||||
|
"modules/invoiceOut/front/**/*",
|
||||||
|
"modules/item/front/**/*",
|
||||||
|
"modules/monitor/front/**/*",
|
||||||
|
"modules/order/front/**/*",
|
||||||
|
"modules/route/front/**/*",
|
||||||
|
"modules/supplier/front/**/*",
|
||||||
|
"modules/ticket/front/**/*",
|
||||||
|
"modules/travel/front/**/*",
|
||||||
|
"modules/worker/front/**/*",
|
||||||
|
"modules/zone/front/**/*"
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
require('require-yaml');
|
const Docker = require('../db/docker.js');
|
||||||
|
let dataSources = require('../loopback/server/datasources.json');
|
||||||
|
|
||||||
process.on('warning', warning => {
|
process.on('warning', warning => {
|
||||||
console.log(warning.name);
|
console.log(warning.name);
|
||||||
|
@ -6,34 +7,53 @@ process.on('warning', warning => {
|
||||||
console.log(warning.stack);
|
console.log(warning.stack);
|
||||||
});
|
});
|
||||||
|
|
||||||
let verbose = false;
|
async function test() {
|
||||||
|
let verbose = false;
|
||||||
|
|
||||||
if (process.argv[2] === '--v')
|
if (process.argv[2] === '--v')
|
||||||
verbose = true;
|
verbose = true;
|
||||||
|
|
||||||
let Jasmine = require('jasmine');
|
const container = new Docker();
|
||||||
let jasmine = new Jasmine();
|
|
||||||
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
|
||||||
|
|
||||||
let serviceSpecs = [
|
await container.run(process.argv.ci);
|
||||||
`${__dirname}/**/*[sS]pec.js`,
|
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||||
`${__dirname}/../loopback/**/*[sS]pec.js`,
|
|
||||||
`${__dirname}/../modules/*/back/**/*.[sS]pec.js`
|
|
||||||
];
|
|
||||||
|
|
||||||
jasmine.loadConfig({
|
Object.assign(dataSources.vn, {
|
||||||
spec_dir: '.',
|
host: container.dbConf.host,
|
||||||
spec_files: serviceSpecs,
|
port: container.dbConf.port
|
||||||
helpers: []
|
});
|
||||||
});
|
|
||||||
|
|
||||||
jasmine.addReporter(new SpecReporter({
|
const bootOptions = {dataSources};
|
||||||
spec: {
|
const app = require('vn-loopback/server/server');
|
||||||
// displayStacktrace: 'summary',
|
app.boot(bootOptions);
|
||||||
displaySuccessful: verbose,
|
|
||||||
displayFailedSpec: true,
|
|
||||||
displaySpecDuration: true
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
jasmine.execute();
|
const Jasmine = require('jasmine');
|
||||||
|
const jasmine = new Jasmine();
|
||||||
|
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||||
|
|
||||||
|
const backSpecs = [
|
||||||
|
'./back/**/*[sS]pec.js',
|
||||||
|
'./loopback/**/*[sS]pec.js',
|
||||||
|
'./modules/*/back/**/*.[sS]pec.js'
|
||||||
|
];
|
||||||
|
|
||||||
|
jasmine.loadConfig({
|
||||||
|
spec_dir: '.',
|
||||||
|
spec_files: backSpecs,
|
||||||
|
helpers: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
jasmine.addReporter(new SpecReporter({
|
||||||
|
spec: {
|
||||||
|
displaySuccessful: verbose,
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
jasmine.exitOnCompletion = false,
|
||||||
|
await jasmine.execute();
|
||||||
|
if (app) await app.disconnect();
|
||||||
|
if (container) await container.rm();
|
||||||
|
console.log('app disconnected & container removed');
|
||||||
|
}
|
||||||
|
|
||||||
|
test();
|
||||||
|
|
|
@ -983,7 +983,7 @@ export default {
|
||||||
},
|
},
|
||||||
invoiceInTax: {
|
invoiceInTax: {
|
||||||
addTaxButton: 'vn-invoice-in-tax vn-icon-button[icon="add_circle"]',
|
addTaxButton: 'vn-invoice-in-tax vn-icon-button[icon="add_circle"]',
|
||||||
thirdExpence: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]',
|
thirdExpense: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]',
|
||||||
thirdTaxableBase: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-input-number[ng-model="invoiceInTax.taxableBase"]',
|
thirdTaxableBase: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-input-number[ng-model="invoiceInTax.taxableBase"]',
|
||||||
thirdTaxType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.taxTypeSageFk"]',
|
thirdTaxType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.taxTypeSageFk"]',
|
||||||
thirdTransactionType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.transactionTypeSageFk"]',
|
thirdTransactionType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.transactionTypeSageFk"]',
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('InvoiceIn tax path', () => {
|
||||||
|
|
||||||
it('should add a new tax', async() => {
|
it('should add a new tax', async() => {
|
||||||
await page.waitToClick(selectors.invoiceInTax.addTaxButton);
|
await page.waitToClick(selectors.invoiceInTax.addTaxButton);
|
||||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpence, '6210000567');
|
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567');
|
||||||
await page.write(selectors.invoiceInTax.thirdTaxableBase, '100');
|
await page.write(selectors.invoiceInTax.thirdTaxableBase, '100');
|
||||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, '6');
|
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, '6');
|
||||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas');
|
await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas');
|
||||||
|
@ -37,9 +37,9 @@ describe('InvoiceIn tax path', () => {
|
||||||
expect(result).toEqual('Taxable base €1,323.16');
|
expect(result).toEqual('Taxable base €1,323.16');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate back to the tax section and check the reciently added line contains the expected expense', async() => {
|
it('should navigate back to tax section, check the reciently added line contains the expected expense', async() => {
|
||||||
await page.accessToSection('invoiceIn.card.tax');
|
await page.accessToSection('invoiceIn.card.tax');
|
||||||
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpence, 'value');
|
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value');
|
||||||
|
|
||||||
expect(result).toEqual('6210000567: Alquiler VNH');
|
expect(result).toEqual('6210000567: Alquiler VNH');
|
||||||
});
|
});
|
||||||
|
|
79
gulpfile.js
79
gulpfile.js
|
@ -68,83 +68,6 @@ back.description = `Starts backend and database service`;
|
||||||
const defaultTask = gulp.parallel(front, back);
|
const defaultTask = gulp.parallel(front, back);
|
||||||
defaultTask.description = `Starts all application services`;
|
defaultTask.description = `Starts all application services`;
|
||||||
|
|
||||||
// Backend tests - Private method
|
|
||||||
|
|
||||||
async function launchBackTest(done) {
|
|
||||||
let err;
|
|
||||||
let dataSources = require('./loopback/server/datasources.json');
|
|
||||||
|
|
||||||
const container = new Docker();
|
|
||||||
await container.run(argv.ci);
|
|
||||||
|
|
||||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
|
||||||
|
|
||||||
Object.assign(dataSources.vn, {
|
|
||||||
host: container.dbConf.host,
|
|
||||||
port: container.dbConf.port
|
|
||||||
});
|
|
||||||
|
|
||||||
let bootOptions = {dataSources};
|
|
||||||
|
|
||||||
let app = require(`./loopback/server/server`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
app.boot(bootOptions);
|
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
const jasmine = require('gulp-jasmine');
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
verbose: false,
|
|
||||||
includeStackTrace: false,
|
|
||||||
errorOnFail: false,
|
|
||||||
timeout: 5000,
|
|
||||||
config: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (argv.ci) {
|
|
||||||
const reporters = require('jasmine-reporters');
|
|
||||||
options.reporter = new reporters.JUnitXmlReporter();
|
|
||||||
}
|
|
||||||
|
|
||||||
let backSpecFiles = [
|
|
||||||
'back/**/*.spec.js',
|
|
||||||
'loopback/**/*.spec.js',
|
|
||||||
'modules/*/back/**/*.spec.js'
|
|
||||||
];
|
|
||||||
|
|
||||||
gulp.src(backSpecFiles)
|
|
||||||
.pipe(jasmine(options))
|
|
||||||
.on('end', resolve)
|
|
||||||
.on('error', reject)
|
|
||||||
.resume();
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
err = e;
|
|
||||||
}
|
|
||||||
await app.disconnect();
|
|
||||||
await container.rm();
|
|
||||||
done();
|
|
||||||
if (err)
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
launchBackTest.description = `
|
|
||||||
Runs the backend tests once using a random container, can receive --ci arg to save reports on a xml file`;
|
|
||||||
|
|
||||||
// Backend tests
|
|
||||||
|
|
||||||
function backTest(done) {
|
|
||||||
const nodemon = require('gulp-nodemon');
|
|
||||||
|
|
||||||
nodemon({
|
|
||||||
exec: ['node --tls-min-v1.0 ./node_modules/gulp/bin/gulp.js'],
|
|
||||||
args: ['launchBackTest'],
|
|
||||||
watch: backSources,
|
|
||||||
done: done
|
|
||||||
});
|
|
||||||
}
|
|
||||||
backTest.description = `Watches for changes in modules to execute backTest task`;
|
|
||||||
|
|
||||||
// End to end tests
|
// End to end tests
|
||||||
function e2eSingleRun() {
|
function e2eSingleRun() {
|
||||||
require('@babel/register')({presets: ['@babel/env']});
|
require('@babel/register')({presets: ['@babel/env']});
|
||||||
|
@ -431,8 +354,6 @@ module.exports = {
|
||||||
back,
|
back,
|
||||||
backOnly,
|
backOnly,
|
||||||
backWatch,
|
backWatch,
|
||||||
backTest,
|
|
||||||
launchBackTest,
|
|
||||||
e2e,
|
e2e,
|
||||||
i,
|
i,
|
||||||
install,
|
install,
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('loopback model address', () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeAll(() => {
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
const LoopBackContext = require('loopback-context');
|
const LoopBackContext = require('loopback-context');
|
||||||
|
const activeCtx = {accessToken: {userId: 9}};
|
||||||
|
|
||||||
describe('entry importBuysPreview()', () => {
|
describe('entry importBuysPreview()', () => {
|
||||||
const entryId = 1;
|
const entryId = 1;
|
||||||
|
|
|
@ -1,9 +1,21 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('route guessPriority()', () => {
|
describe('route guessPriority()', () => {
|
||||||
const targetRouteId = 7;
|
const targetRouteId = 7;
|
||||||
let routeTicketsToRestore;
|
let routeTicketsToRestore;
|
||||||
|
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
__: () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
let restoreFixtures = [];
|
let restoreFixtures = [];
|
||||||
routeTicketsToRestore.forEach(ticket => {
|
routeTicketsToRestore.forEach(ticket => {
|
||||||
|
@ -12,12 +24,9 @@ describe('route guessPriority()', () => {
|
||||||
await Promise.all(restoreFixtures);
|
await Promise.all(restoreFixtures);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call guessPriority() and then check the tickets in the target route now have their priorities defined', async() => {
|
it('should call guessPriority() then check all tickets in that route have their priorities defined', async() => {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
req: {
|
req: activeCtx
|
||||||
accessToken: {userId: 9},
|
|
||||||
__: () => {}
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
routeTicketsToRestore = await app.models.Ticket.find({where: {routeFk: targetRouteId}});
|
routeTicketsToRestore = await app.models.Ticket.find({where: {routeFk: targetRouteId}});
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,7 +68,6 @@
|
||||||
"gulp-env": "^0.4.0",
|
"gulp-env": "^0.4.0",
|
||||||
"gulp-file": "^0.4.0",
|
"gulp-file": "^0.4.0",
|
||||||
"gulp-install": "^1.1.0",
|
"gulp-install": "^1.1.0",
|
||||||
"gulp-jasmine": "^4.0.0",
|
|
||||||
"gulp-merge-json": "^1.3.1",
|
"gulp-merge-json": "^1.3.1",
|
||||||
"gulp-nodemon": "^2.5.0",
|
"gulp-nodemon": "^2.5.0",
|
||||||
"gulp-print": "^2.0.1",
|
"gulp-print": "^2.0.1",
|
||||||
|
@ -78,7 +77,7 @@
|
||||||
"html-loader-jest": "^0.2.1",
|
"html-loader-jest": "^0.2.1",
|
||||||
"html-webpack-plugin": "^4.0.0-beta.11",
|
"html-webpack-plugin": "^4.0.0-beta.11",
|
||||||
"identity-obj-proxy": "^3.0.0",
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"jasmine": "^3.10.0",
|
"jasmine": "^4.1.0",
|
||||||
"jasmine-reporters": "^2.4.0",
|
"jasmine-reporters": "^2.4.0",
|
||||||
"jasmine-spec-reporter": "^7.0.0",
|
"jasmine-spec-reporter": "^7.0.0",
|
||||||
"jest": "^26.0.1",
|
"jest": "^26.0.1",
|
||||||
|
@ -88,7 +87,7 @@
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"mysql2": "^1.7.0",
|
"mysql2": "^1.7.0",
|
||||||
"node-sass": "^4.14.1",
|
"node-sass": "^4.14.1",
|
||||||
"nodemon": "^1.19.4",
|
"nodemon": "^2.0.16",
|
||||||
"plugin-error": "^1.0.1",
|
"plugin-error": "^1.0.1",
|
||||||
"raw-loader": "^1.0.0",
|
"raw-loader": "^1.0.0",
|
||||||
"regenerator-runtime": "^0.13.7",
|
"regenerator-runtime": "^0.13.7",
|
||||||
|
@ -102,6 +101,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dbtest": "nodemon -q db/tests.js -w db/tests",
|
"dbtest": "nodemon -q db/tests.js -w db/tests",
|
||||||
|
"backtest": "nodemon -q back/tests.js --config back/nodemonConfig.json",
|
||||||
"test": "jest --watch",
|
"test": "jest --watch",
|
||||||
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
|
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
|
||||||
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
|
||||||
|
|
Loading…
Reference in New Issue