refs #6436 feat: extend BeforeAll
This commit is contained in:
parent
bfb6b25d1a
commit
a5d262671d
|
@ -10,7 +10,7 @@ async function init() {
|
|||
host: process.env.DB_HOST,
|
||||
port: process.env.DB_PORT
|
||||
});
|
||||
|
||||
customBeforeAll();
|
||||
const bootOptions = {dataSources};
|
||||
await new Promise((resolve, reject) => {
|
||||
app.boot(bootOptions,
|
||||
|
@ -24,7 +24,16 @@ async function deinit() {
|
|||
console.log('Stopping backend.');
|
||||
await app.disconnect();
|
||||
}
|
||||
|
||||
function customBeforeAll() {
|
||||
Object.assign(beforeAll, {
|
||||
ctx: {
|
||||
req: {
|
||||
accessToken: {userId: 9},
|
||||
headers: {origin: 'http://localhost'},
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
module.exports = {
|
||||
init,
|
||||
deinit
|
||||
|
@ -32,3 +41,4 @@ module.exports = {
|
|||
|
||||
if (require.main === module)
|
||||
init();
|
||||
|
||||
|
|
|
@ -84,13 +84,12 @@ async function test() {
|
|||
'loopback/**/*[sS]pec.js',
|
||||
'modules/*/back/**/*.[sS]pec.js'
|
||||
],
|
||||
helpers: []
|
||||
helpers: [`back/tests-helper.js`]
|
||||
};
|
||||
|
||||
if (PARALLEL) {
|
||||
const ParallelRunner = require('jasmine/parallel');
|
||||
runner = new ParallelRunner({numWorkers: 1});
|
||||
config.helpers.push(`back/tests-helper.js`);
|
||||
} else {
|
||||
const Jasmine = require('jasmine');
|
||||
runner = new Jasmine();
|
||||
|
|
Loading…
Reference in New Issue