Compare commits
No commits in common. "bd990cf1051558b195296ab2fd49af2b3b96ad7e" and "fe48e27cceda7fc06b1a5f0dea646f0fc9c12ee4" have entirely different histories.
bd990cf105
...
fe48e27cce
|
@ -1,10 +1,9 @@
|
|||
/* eslint-disable no-console */
|
||||
const path = require('path');
|
||||
const Myt = require('@verdnatura/myt/myt');
|
||||
const Run = require('@verdnatura/myt/myt-run');
|
||||
let dataSources = require('../loopback/server/datasources.json');
|
||||
|
||||
let server;
|
||||
let myt;
|
||||
|
||||
process.on('warning', warning => {
|
||||
console.log(warning.name);
|
||||
|
@ -12,33 +11,26 @@ process.on('warning', warning => {
|
|||
console.log(warning.stack);
|
||||
});
|
||||
|
||||
process.on('SIGUSR2', rmServer);
|
||||
process.on('exit', rmServer);
|
||||
process.on('SIGUSR2', async() => {
|
||||
if (myt) await myt.deinit();
|
||||
});
|
||||
|
||||
async function rmServer() {
|
||||
if (!server) return;
|
||||
await server.rm();
|
||||
server = null;
|
||||
}
|
||||
process.on('exit', async function() {
|
||||
if (myt) await myt.deinit();
|
||||
});
|
||||
|
||||
async function test() {
|
||||
console.log('Building and running DB container.');
|
||||
|
||||
const isCI = process.argv[2] === 'ci';
|
||||
|
||||
const myt = new Myt();
|
||||
myt = new Myt();
|
||||
await myt.init({
|
||||
workspace: path.join(__dirname, '..'),
|
||||
random: true,
|
||||
ci: isCI,
|
||||
tmpfs: process.platform == 'linux',
|
||||
tmpfs: true,
|
||||
network: isCI ? 'jenkins' : null
|
||||
});
|
||||
server = await myt.run(Run);
|
||||
await myt.deinit();
|
||||
const {dbConfig} = server;
|
||||
|
||||
console.log('Initializing backend.');
|
||||
const {dbConfig} = await myt.run(Run);
|
||||
|
||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||
Object.assign(dataSources.vn, {
|
||||
|
@ -55,8 +47,6 @@ async function test() {
|
|||
// FIXME: Workaround to wait for loopback to be ready
|
||||
await app.models.Application.status();
|
||||
|
||||
console.log('Running tests.');
|
||||
|
||||
const Jasmine = require('jasmine');
|
||||
const jasmine = new Jasmine();
|
||||
|
||||
|
@ -92,13 +82,9 @@ async function test() {
|
|||
});
|
||||
|
||||
await jasmine.execute();
|
||||
|
||||
console.log('Stopping.');
|
||||
|
||||
if (app) await app.disconnect();
|
||||
await rmServer();
|
||||
|
||||
console.log('Tests ended.\n');
|
||||
if (myt) await myt.deinit();
|
||||
console.log('App disconnected & container removed');
|
||||
}
|
||||
|
||||
test();
|
||||
|
|
Loading…
Reference in New Issue