This repository has been archived by the owner on Aug 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallaby.js
70 lines (66 loc) · 2.56 KB
/
wallaby.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module.exports = function(wallaby) {
return {
// debug: true,
files: [
{pattern: "api/shared/email.service.ts", instrument: false, load: true}, //do not include this in coverage cause we don't send emails during tests
{pattern: "api/shared/logger.service.ts", instrument: false, load: true}, //do not include this in coverage cause we don't send emails during tests
{pattern: "db.config.ts", instrument: false, load: true}, //do not include this in coverage cause we don't send emails during tests
"!api/**/*.spec.ts",
"!api/**/*.e2e.ts",
"!gulpfile*",
"!**/*.sample.ts",
"api/**/*.ts",
"configs/**/*.ts",
"*.ts",
"temp/",
"**/*.jpg",
"logs/**/*.log",
".env",
],
env: {
type: 'node',
params: {
env: 'NODE_ENV=test'
}
},
tests: [
'api/**/*.spec.ts'
],
compilers: {
'**/*.ts?(x)': wallaby.compilers.typeScript({
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "commonjs",
"outDir": "build",
"target": "es6"
})
},
testFramework: 'mocha',
workers: {
recycle: false
},
bootstrap: function(wallaby) {
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
require('dotenv').config({silent: true});
process.env.USER_UPLOADS_SIZE_LIMIT = 50 * 1024; // 50KB
process.env.UPLOADS_TEMP = "/opt/api-seed/temp";
process.env.UPLOADS_LOCAL_PATH = "/opt/api-seed";
process.env.SENSOR_DEFAULT_IMAGE = "asd.png";
let mongoose = require('mongoose');
mongoose.models = {};
mongoose.modelSchemas = {};
// DB setup code
let config = require('./configs/config').default;
config.db.url = config.db.url + '-' + wallaby.workerId;
// set up port for each process
config.port = getRandomInt(1001, 50000); // ensure port used is above 1000 (restricted ports)
config.test.url = `http://localhost:${config.port}`; // ensure port used is above 1000 (restricted ports)
},
teardown: function(wallaby) {
let mongoose = require('mongoose');
mongoose.connection.close();
}
};
};