forked from renovatorruler/sol-unit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
91 lines (76 loc) · 2.78 KB
/
index.js
File metadata and controls
91 lines (76 loc) · 2.78 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* @file index.js
* @fileOverview index file.
* @author Andreas Olofsson (androlo1980@gmail.com)
* @module index
*/
'use strict';
var SolUnit = require('./lib/sol_unit');
var presenter = require('./lib/log_presenter');
exports.runTests = function(tests, rootDir, logging, cb){
var sUnit = new SolUnit();
// Set the callbacks up.
sUnit.on('suiteStarted', suiteStarted);
sUnit.on('contractStarted', contractStarted);
sUnit.on('methodsStarted', methodsStarted);
sUnit.on('methodStarted', methodStarted);
sUnit.on('methodDone', methodDone);
sUnit.on('methodsDone', methodsDone);
sUnit.on('contractDone', contractDone);
sUnit.on('suiteDone', suiteDone);
renderLogo();
sUnit.start(tests, rootDir);
function suiteStarted(error, tests) {
if(error) throw new Error(error);
if(logging) {
presenter.presentSuiteStarted(error, tests);
}
}
function contractStarted(error, name) {
if(logging) {
presenter.presentContractStarted(error, name);
}
}
function methodsStarted(error, methods) {
if(logging) {
presenter.presentMethodsStarted(error, methods);
}
}
function methodStarted(methodName) {
if(logging) {
presenter.presentMethodStarted(methodName);
}
}
function methodDone(results) {
if(logging) {
presenter.presentMethodDone(results);
}
}
function methodsDone(error, contractName, stats) {
if(logging) {
presenter.presentMethodsDone(error, contractName, stats);
}
}
function contractDone(error, name) {
}
function suiteDone(stats) {
if(logging) {
presenter.presentSuiteDone(stats);
}
cb(stats);
}
};
function renderLogo() {
console.log(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ");
console.log("| _ _ _ _ |");
console.log("| | | | | (_)| | |");
console.log("| ___ | | | | _ __ _ | |_ |");
console.log("| / __|| | | || '_ \\ | || __| |");
console.log("| \\__ \\| |_| || | | || || |_ |");
console.log("| |___/ \\___/ |_| |_||_| \\__| |");
console.log("| |");
console.log("| By: Andreas Olofsson |");
console.log("| e-mail: androlo1980@gmail.com |");
console.log("| |");
console.log("*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*");
}