diff --git a/Dockerfile b/back/Dockerfile similarity index 100% rename from Dockerfile rename to back/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 8391a5e23..43a528a8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,10 +19,11 @@ services: back: image: registry.verdnatura.es/salix-back:${VERSION:?} build: . + dockerfile: back/Dockerfile environment: + - TZ - NODE_ENV - DEBUG - - TZ ports: - 3000 configs: diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js index a4a059622..7dd299e0b 100644 --- a/e2e/helpers/tests.js +++ b/e2e/helpers/tests.js @@ -1,7 +1,9 @@ +/* eslint-disable no-console */ require('@babel/register')({presets: ['@babel/env']}); require('core-js/stable'); require('regenerator-runtime/runtime'); require('vn-loopback/server/boot/date')(); +const getopts = require('getopts'); const path = require('path'); const Myt = require('@verdnatura/myt/myt'); @@ -18,12 +20,16 @@ process.on('warning', warning => { }); async function test() { - if (process.argv[2] === 'show') - process.env.E2E_SHOW = true; + const opts = getopts(process.argv.slice(2), { + boolean: ['show'] + }); + process.env.E2E_SHOW = opts.show; + console.log('Building and running DB container.'); const myt = new Myt(); await myt.init({workspace: path.join(__dirname, '../..')}); await myt.run(Run); + await myt.deinit(); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); @@ -70,12 +76,10 @@ async function test() { jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; await jasmine.execute(); - - await myt.deinit(); } async function backendStatus() { - log('Awaiting backend connection...'); + log('Awaiting backend connection.'); const milliseconds = 1000; const maxAttempts = 10; diff --git a/fileMock.js b/front/jest-mock.js similarity index 100% rename from fileMock.js rename to front/jest-mock.js diff --git a/jest-front.js b/front/jest-setup.js similarity index 59% rename from jest-front.js rename to front/jest-setup.js index eabda9110..eebd99bbd 100644 --- a/jest-front.js +++ b/front/jest-setup.js @@ -1,19 +1,19 @@ import 'angular'; import 'angular-mocks'; -import core from './front/core/module.js'; -import './front/salix/components/app/app.js'; -import './modules/zone/front/module.js'; -import './modules/claim/front/module.js'; -import './modules/client/front/module.js'; -import './modules/invoiceOut/front/module.js'; -import './modules/invoiceIn/front/module.js'; -import './modules/item/front/module.js'; -import './modules/order/front/module.js'; -import './modules/route/front/module.js'; -import './modules/ticket/front/module.js'; -import './modules/travel/front/module.js'; -import './modules/worker/front/module.js'; -import './modules/shelving/front/module.js'; +import core from './core/module.js'; +import './salix/components/app/app.js'; +import '../modules/zone/front/module.js'; +import '../modules/claim/front/module.js'; +import '../modules/client/front/module.js'; +import '../modules/invoiceOut/front/module.js'; +import '../modules/invoiceIn/front/module.js'; +import '../modules/item/front/module.js'; +import '../modules/order/front/module.js'; +import '../modules/route/front/module.js'; +import '../modules/ticket/front/module.js'; +import '../modules/travel/front/module.js'; +import '../modules/worker/front/module.js'; +import '../modules/shelving/front/module.js'; import 'vn-loopback/server/boot/date'; // Set NODE_ENV diff --git a/gulpfile.js b/gulpfile.js index 255b1ee05..054a65c1c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,6 @@ require('require-yaml'); const gulp = require('gulp'); const PluginError = require('plugin-error'); -const argv = require('minimist')(process.argv.slice(2)); const log = require('fancy-log'); const Myt = require('@verdnatura/myt/myt'); const Run = require('@verdnatura/myt/myt-run'); @@ -12,9 +11,6 @@ const Start = require('@verdnatura/myt/myt-start'); let isWindows = /^win/.test(process.platform); -if (argv.NODE_ENV) - process.env.NODE_ENV = argv.NODE_ENV; - let langs = ['es', 'en']; let srcDir = './front'; let modulesDir = './modules'; diff --git a/jest.front.config.js b/jest.front.config.js index 3289df8bb..a843832ea 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -10,7 +10,7 @@ module.exports = { }, testEnvironment: 'jsdom', setupFilesAfterEnv: [ - './jest-front.js' + './front/jest-setup.js' ], testMatch: [ '**/front/**/*.spec.js', @@ -37,7 +37,7 @@ module.exports = { ], moduleNameMapper: { '\\.(css|scss)$': 'identity-obj-proxy', - '\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/fileMock.js', + '\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/front/jest-mock.js', }, testURL: 'http://localhost', verbose: false, diff --git a/package.json b/package.json index 197c1094d..9ae8b276b 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "js-yaml": "^4.1.0", "json-loader": "^0.5.7", "merge-stream": "^1.0.1", - "minimist": "^1.2.5", "node-sass": "^9.0.0", "nodemon": "^2.0.16", "plugin-error": "^1.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 19f57caf9..221008dd9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -232,9 +232,6 @@ devDependencies: merge-stream: specifier: ^1.0.1 version: 1.0.1 - minimist: - specifier: ^1.2.5 - version: 1.2.8 node-sass: specifier: ^9.0.0 version: 9.0.0