-
Notifications
You must be signed in to change notification settings - Fork 4
/
internal.js
107 lines (103 loc) · 2.9 KB
/
internal.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"use strict"
var Thallium = require("./lib/api/thallium")
// var Reports = require("./lib/core/reports-tree")
// var Types = Reports.Types
exports.root = function () {
return new Thallium()
}
// TODO: translate these
// function d(duration) {
// if (duration == null) return 10
// if (typeof duration === "number") return duration|0
// throw new TypeError("Expected `duration` to be a number if it exists")
// }
//
// function s(slow) {
// if (slow == null) return 75
// if (typeof slow === "number") return slow|0
// throw new TypeError("Expected `slow` to be a number if it exists")
// }
//
// function p(path) {
// if (Array.isArray(path)) return path
// throw new TypeError("Expected `path` to be an array of locations")
// }
//
// /**
// * Create a new report, mainly for testing reporters.
// */
// exports.reports = {
// start: function () {
// return Reports.start()
// },
//
// enter: function (path, duration, slow) {
// return Reports.enter(p(path), d(duration), s(slow))
// },
//
// leave: function (path) {
// return Reports.leave(p(path))
// },
//
// pass: function (path, duration, slow) {
// return Reports.pass(p(path), d(duration), s(slow))
// },
//
// fail: function (path, value, duration, slow, isFailable) {
// return Reports.fail(
// p(path), value, d(duration), s(slow),
// !!isFailable)
// },
//
// skip: function (path) {
// return Reports.skip(p(path))
// },
//
// end: function () {
// return Reports.end()
// },
//
// error: function (value) {
// return Reports.error(value)
// },
//
// /**
// * Create a new hook error, mainly for testing reporters.
// */
// hook: {
// beforeAll: function (path, rootPath, func, value) {
// return Reports.hook(Types.BeforeAll, p(path), p(rootPath),
// func, value)
// },
//
// beforeEach: function (path, rootPath, func, value) {
// return Reports.hook(Types.BeforeEach, p(path), p(rootPath),
// func, value)
// },
//
// afterEach: function (path, rootPath, func, value) {
// return Reports.hook(Types.AfterEach, p(path), p(rootPath),
// func, value)
// },
//
// afterAll: function (path, rootPath, func, value) {
// return Reports.hook(Types.AfterAll, p(path), p(rootPath),
// func, value)
// },
// },
// }
//
// /**
// * Creates a new location, mainly for testing reporters.
// */
// exports.location = function (name, index) {
// if (typeof name !== "string") {
// throw new TypeError("Expected `name` to be a string")
// }
//
// if (typeof index !== "number") {
// throw new TypeError("Expected `index` to be a number")
// }
//
// return {name: name, index: index|0}
// }