-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
42 lines (29 loc) · 907 Bytes
/
test.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
require("dotenv").load({path: ".env-test", silent: true})
var co = require("co")
var supertest = require("co-supertest")
var ZenInjector = require("zeninjector")
var testRunner = require("bandage/runner")
var testHelper = require("./test/helper")
co(function* runTests() {
var container = new ZenInjector({
mock_modules: {}
})
container.registerAndExport("logger", console)
yield container.scan(__dirname + "/src/**/*.js")
var api = yield container.resolve("api")
api.app.on("error", function(err) {
console.log(err)
})
var request = supertest(api.app.callback())
var helper = testHelper(request, container)
var file = process.argv[2]
if (file) {
console.log("Test file: ", file)
}
var db = yield container.resolve("db")
testRunner ( [ request, helper, container ], file, db.disconnect)
}).catch(function(err) {
console.log(err.stack)
console.log(err)
process.exit(1)
})