ortoni-report 2.0.5 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +30 -0
- package/dist/ortoni-report.d.ts +16 -4
- package/dist/ortoni-report.js +428 -240
- package/dist/ortoni-report.mjs +428 -240
- package/dist/style/main.css +92 -128
- package/dist/views/head.hbs +11 -0
- package/dist/views/main.hbs +482 -440
- package/dist/views/navbar.hbs +2 -12
- package/dist/views/project.hbs +201 -95
- package/dist/views/testIcons.hbs +13 -0
- package/dist/views/testPanel.hbs +16 -7
- package/dist/views/testStatus.hbs +8 -32
- package/package.json +4 -1
- package/readme.md +41 -22
- package/dist/types/reporterConfig.js +0 -2
- package/dist/types/testResults.js +0 -2
- package/dist/utils/expressServer.js +0 -33
- package/dist/utils/utils.js +0 -85
- package/dist/utils/webSocketHelper.js +0 -93
package/dist/ortoni-report.mjs
CHANGED
|
@@ -1198,13 +1198,13 @@ var require_ast = __commonJS({
|
|
|
1198
1198
|
helperExpression: function helperExpression(node) {
|
|
1199
1199
|
return node.type === "SubExpression" || (node.type === "MustacheStatement" || node.type === "BlockStatement") && !!(node.params && node.params.length || node.hash);
|
|
1200
1200
|
},
|
|
1201
|
-
scopedId: function scopedId(
|
|
1202
|
-
return /^\.|this\b/.test(
|
|
1201
|
+
scopedId: function scopedId(path8) {
|
|
1202
|
+
return /^\.|this\b/.test(path8.original);
|
|
1203
1203
|
},
|
|
1204
1204
|
// an ID is simple if it only has one part, and that part is not
|
|
1205
1205
|
// `..` or `this`.
|
|
1206
|
-
simpleId: function simpleId(
|
|
1207
|
-
return
|
|
1206
|
+
simpleId: function simpleId(path8) {
|
|
1207
|
+
return path8.parts.length === 1 && !AST.helpers.scopedId(path8) && !path8.depth;
|
|
1208
1208
|
}
|
|
1209
1209
|
}
|
|
1210
1210
|
};
|
|
@@ -2229,11 +2229,11 @@ var require_helpers2 = __commonJS({
|
|
|
2229
2229
|
}
|
|
2230
2230
|
var _exception = require_exception();
|
|
2231
2231
|
var _exception2 = _interopRequireDefault(_exception);
|
|
2232
|
-
function validateClose(
|
|
2232
|
+
function validateClose(open2, close) {
|
|
2233
2233
|
close = close.path ? close.path.original : close;
|
|
2234
|
-
if (
|
|
2235
|
-
var errorNode = { loc:
|
|
2236
|
-
throw new _exception2["default"](
|
|
2234
|
+
if (open2.path.original !== close) {
|
|
2235
|
+
var errorNode = { loc: open2.path.loc };
|
|
2236
|
+
throw new _exception2["default"](open2.path.original + " doesn't match " + close, errorNode);
|
|
2237
2237
|
}
|
|
2238
2238
|
}
|
|
2239
2239
|
function SourceLocation(source, locInfo) {
|
|
@@ -2254,9 +2254,9 @@ var require_helpers2 = __commonJS({
|
|
|
2254
2254
|
return token;
|
|
2255
2255
|
}
|
|
2256
2256
|
}
|
|
2257
|
-
function stripFlags(
|
|
2257
|
+
function stripFlags(open2, close) {
|
|
2258
2258
|
return {
|
|
2259
|
-
open:
|
|
2259
|
+
open: open2.charAt(2) === "~",
|
|
2260
2260
|
close: close.charAt(close.length - 3) === "~"
|
|
2261
2261
|
};
|
|
2262
2262
|
}
|
|
@@ -2288,12 +2288,12 @@ var require_helpers2 = __commonJS({
|
|
|
2288
2288
|
loc
|
|
2289
2289
|
};
|
|
2290
2290
|
}
|
|
2291
|
-
function prepareMustache(
|
|
2292
|
-
var escapeFlag =
|
|
2293
|
-
var decorator = /\*/.test(
|
|
2291
|
+
function prepareMustache(path8, params, hash, open2, strip, locInfo) {
|
|
2292
|
+
var escapeFlag = open2.charAt(3) || open2.charAt(2), escaped = escapeFlag !== "{" && escapeFlag !== "&";
|
|
2293
|
+
var decorator = /\*/.test(open2);
|
|
2294
2294
|
return {
|
|
2295
2295
|
type: decorator ? "Decorator" : "MustacheStatement",
|
|
2296
|
-
path:
|
|
2296
|
+
path: path8,
|
|
2297
2297
|
params,
|
|
2298
2298
|
hash,
|
|
2299
2299
|
escaped,
|
|
@@ -2381,15 +2381,15 @@ var require_helpers2 = __commonJS({
|
|
|
2381
2381
|
loc
|
|
2382
2382
|
};
|
|
2383
2383
|
}
|
|
2384
|
-
function preparePartialBlock(
|
|
2385
|
-
validateClose(
|
|
2384
|
+
function preparePartialBlock(open2, program, close, locInfo) {
|
|
2385
|
+
validateClose(open2, close);
|
|
2386
2386
|
return {
|
|
2387
2387
|
type: "PartialBlockStatement",
|
|
2388
|
-
name:
|
|
2389
|
-
params:
|
|
2390
|
-
hash:
|
|
2388
|
+
name: open2.path,
|
|
2389
|
+
params: open2.params,
|
|
2390
|
+
hash: open2.hash,
|
|
2391
2391
|
program,
|
|
2392
|
-
openStrip:
|
|
2392
|
+
openStrip: open2.strip,
|
|
2393
2393
|
closeStrip: close && close.strip,
|
|
2394
2394
|
loc: this.locInfo(locInfo)
|
|
2395
2395
|
};
|
|
@@ -2564,9 +2564,9 @@ var require_compiler = __commonJS({
|
|
|
2564
2564
|
},
|
|
2565
2565
|
DecoratorBlock: function DecoratorBlock(decorator) {
|
|
2566
2566
|
var program = decorator.program && this.compileProgram(decorator.program);
|
|
2567
|
-
var params = this.setupFullMustacheParams(decorator, program, void 0),
|
|
2567
|
+
var params = this.setupFullMustacheParams(decorator, program, void 0), path8 = decorator.path;
|
|
2568
2568
|
this.useDecorators = true;
|
|
2569
|
-
this.opcode("registerDecorator", params.length,
|
|
2569
|
+
this.opcode("registerDecorator", params.length, path8.original);
|
|
2570
2570
|
},
|
|
2571
2571
|
PartialStatement: function PartialStatement(partial) {
|
|
2572
2572
|
this.usePartial = true;
|
|
@@ -2630,46 +2630,46 @@ var require_compiler = __commonJS({
|
|
|
2630
2630
|
}
|
|
2631
2631
|
},
|
|
2632
2632
|
ambiguousSexpr: function ambiguousSexpr(sexpr, program, inverse) {
|
|
2633
|
-
var
|
|
2634
|
-
this.opcode("getContext",
|
|
2633
|
+
var path8 = sexpr.path, name = path8.parts[0], isBlock = program != null || inverse != null;
|
|
2634
|
+
this.opcode("getContext", path8.depth);
|
|
2635
2635
|
this.opcode("pushProgram", program);
|
|
2636
2636
|
this.opcode("pushProgram", inverse);
|
|
2637
|
-
|
|
2638
|
-
this.accept(
|
|
2637
|
+
path8.strict = true;
|
|
2638
|
+
this.accept(path8);
|
|
2639
2639
|
this.opcode("invokeAmbiguous", name, isBlock);
|
|
2640
2640
|
},
|
|
2641
2641
|
simpleSexpr: function simpleSexpr(sexpr) {
|
|
2642
|
-
var
|
|
2643
|
-
|
|
2644
|
-
this.accept(
|
|
2642
|
+
var path8 = sexpr.path;
|
|
2643
|
+
path8.strict = true;
|
|
2644
|
+
this.accept(path8);
|
|
2645
2645
|
this.opcode("resolvePossibleLambda");
|
|
2646
2646
|
},
|
|
2647
2647
|
helperSexpr: function helperSexpr(sexpr, program, inverse) {
|
|
2648
|
-
var params = this.setupFullMustacheParams(sexpr, program, inverse),
|
|
2648
|
+
var params = this.setupFullMustacheParams(sexpr, program, inverse), path8 = sexpr.path, name = path8.parts[0];
|
|
2649
2649
|
if (this.options.knownHelpers[name]) {
|
|
2650
2650
|
this.opcode("invokeKnownHelper", params.length, name);
|
|
2651
2651
|
} else if (this.options.knownHelpersOnly) {
|
|
2652
2652
|
throw new _exception2["default"]("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
|
|
2653
2653
|
} else {
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
this.accept(
|
|
2657
|
-
this.opcode("invokeHelper", params.length,
|
|
2654
|
+
path8.strict = true;
|
|
2655
|
+
path8.falsy = true;
|
|
2656
|
+
this.accept(path8);
|
|
2657
|
+
this.opcode("invokeHelper", params.length, path8.original, _ast2["default"].helpers.simpleId(path8));
|
|
2658
2658
|
}
|
|
2659
2659
|
},
|
|
2660
|
-
PathExpression: function PathExpression(
|
|
2661
|
-
this.addDepth(
|
|
2662
|
-
this.opcode("getContext",
|
|
2663
|
-
var name =
|
|
2660
|
+
PathExpression: function PathExpression(path8) {
|
|
2661
|
+
this.addDepth(path8.depth);
|
|
2662
|
+
this.opcode("getContext", path8.depth);
|
|
2663
|
+
var name = path8.parts[0], scoped = _ast2["default"].helpers.scopedId(path8), blockParamId = !path8.depth && !scoped && this.blockParamIndex(name);
|
|
2664
2664
|
if (blockParamId) {
|
|
2665
|
-
this.opcode("lookupBlockParam", blockParamId,
|
|
2665
|
+
this.opcode("lookupBlockParam", blockParamId, path8.parts);
|
|
2666
2666
|
} else if (!name) {
|
|
2667
2667
|
this.opcode("pushContext");
|
|
2668
|
-
} else if (
|
|
2668
|
+
} else if (path8.data) {
|
|
2669
2669
|
this.options.data = true;
|
|
2670
|
-
this.opcode("lookupData",
|
|
2670
|
+
this.opcode("lookupData", path8.depth, path8.parts, path8.strict);
|
|
2671
2671
|
} else {
|
|
2672
|
-
this.opcode("lookupOnContext",
|
|
2672
|
+
this.opcode("lookupOnContext", path8.parts, path8.falsy, path8.strict, scoped);
|
|
2673
2673
|
}
|
|
2674
2674
|
},
|
|
2675
2675
|
StringLiteral: function StringLiteral(string) {
|
|
@@ -3020,16 +3020,16 @@ var require_util = __commonJS({
|
|
|
3020
3020
|
}
|
|
3021
3021
|
exports.urlGenerate = urlGenerate;
|
|
3022
3022
|
function normalize(aPath) {
|
|
3023
|
-
var
|
|
3023
|
+
var path8 = aPath;
|
|
3024
3024
|
var url = urlParse(aPath);
|
|
3025
3025
|
if (url) {
|
|
3026
3026
|
if (!url.path) {
|
|
3027
3027
|
return aPath;
|
|
3028
3028
|
}
|
|
3029
|
-
|
|
3029
|
+
path8 = url.path;
|
|
3030
3030
|
}
|
|
3031
|
-
var isAbsolute = exports.isAbsolute(
|
|
3032
|
-
var parts =
|
|
3031
|
+
var isAbsolute = exports.isAbsolute(path8);
|
|
3032
|
+
var parts = path8.split(/\/+/);
|
|
3033
3033
|
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
|
|
3034
3034
|
part = parts[i];
|
|
3035
3035
|
if (part === ".") {
|
|
@@ -3046,15 +3046,15 @@ var require_util = __commonJS({
|
|
|
3046
3046
|
}
|
|
3047
3047
|
}
|
|
3048
3048
|
}
|
|
3049
|
-
|
|
3050
|
-
if (
|
|
3051
|
-
|
|
3049
|
+
path8 = parts.join("/");
|
|
3050
|
+
if (path8 === "") {
|
|
3051
|
+
path8 = isAbsolute ? "/" : ".";
|
|
3052
3052
|
}
|
|
3053
3053
|
if (url) {
|
|
3054
|
-
url.path =
|
|
3054
|
+
url.path = path8;
|
|
3055
3055
|
return urlGenerate(url);
|
|
3056
3056
|
}
|
|
3057
|
-
return
|
|
3057
|
+
return path8;
|
|
3058
3058
|
}
|
|
3059
3059
|
exports.normalize = normalize;
|
|
3060
3060
|
function join(aRoot, aPath) {
|
|
@@ -5836,8 +5836,8 @@ var require_printer = __commonJS({
|
|
|
5836
5836
|
return this.accept(sexpr.path) + " " + params + hash;
|
|
5837
5837
|
};
|
|
5838
5838
|
PrintVisitor.prototype.PathExpression = function(id) {
|
|
5839
|
-
var
|
|
5840
|
-
return (id.data ? "@" : "") + "PATH:" +
|
|
5839
|
+
var path8 = id.parts.join("/");
|
|
5840
|
+
return (id.data ? "@" : "") + "PATH:" + path8;
|
|
5841
5841
|
};
|
|
5842
5842
|
PrintVisitor.prototype.StringLiteral = function(string) {
|
|
5843
5843
|
return '"' + string.value + '"';
|
|
@@ -20772,11 +20772,11 @@ var require_mime_types = __commonJS({
|
|
|
20772
20772
|
}
|
|
20773
20773
|
return exts[0];
|
|
20774
20774
|
}
|
|
20775
|
-
function lookup(
|
|
20776
|
-
if (!
|
|
20775
|
+
function lookup(path8) {
|
|
20776
|
+
if (!path8 || typeof path8 !== "string") {
|
|
20777
20777
|
return false;
|
|
20778
20778
|
}
|
|
20779
|
-
var extension2 = extname("x." +
|
|
20779
|
+
var extension2 = extname("x." + path8).toLowerCase().substr(1);
|
|
20780
20780
|
if (!extension2) {
|
|
20781
20781
|
return false;
|
|
20782
20782
|
}
|
|
@@ -23935,7 +23935,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
23935
23935
|
"node_modules/path-to-regexp/index.js"(exports, module) {
|
|
23936
23936
|
module.exports = pathToRegexp;
|
|
23937
23937
|
var MATCHING_GROUP_REGEXP = /\\.|\((?:\?<(.*?)>)?(?!\?)/g;
|
|
23938
|
-
function pathToRegexp(
|
|
23938
|
+
function pathToRegexp(path8, keys, options) {
|
|
23939
23939
|
options = options || {};
|
|
23940
23940
|
keys = keys || [];
|
|
23941
23941
|
var strict = options.strict;
|
|
@@ -23949,8 +23949,8 @@ var require_path_to_regexp = __commonJS({
|
|
|
23949
23949
|
var pos = 0;
|
|
23950
23950
|
var backtrack = "";
|
|
23951
23951
|
var m;
|
|
23952
|
-
if (
|
|
23953
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
23952
|
+
if (path8 instanceof RegExp) {
|
|
23953
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path8.source)) {
|
|
23954
23954
|
if (m[0][0] === "\\")
|
|
23955
23955
|
continue;
|
|
23956
23956
|
keys.push({
|
|
@@ -23959,15 +23959,15 @@ var require_path_to_regexp = __commonJS({
|
|
|
23959
23959
|
offset: m.index
|
|
23960
23960
|
});
|
|
23961
23961
|
}
|
|
23962
|
-
return
|
|
23962
|
+
return path8;
|
|
23963
23963
|
}
|
|
23964
|
-
if (Array.isArray(
|
|
23965
|
-
|
|
23964
|
+
if (Array.isArray(path8)) {
|
|
23965
|
+
path8 = path8.map(function(value) {
|
|
23966
23966
|
return pathToRegexp(value, keys, options).source;
|
|
23967
23967
|
});
|
|
23968
|
-
return new RegExp(
|
|
23968
|
+
return new RegExp(path8.join("|"), flags);
|
|
23969
23969
|
}
|
|
23970
|
-
|
|
23970
|
+
path8 = path8.replace(
|
|
23971
23971
|
/\\.|(\/)?(\.)?:(\w+)(\(.*?\))?(\*)?(\?)?|[.*]|\/\(/g,
|
|
23972
23972
|
function(match, slash, format, key, capture, star, optional, offset) {
|
|
23973
23973
|
pos = offset + match.length;
|
|
@@ -23980,7 +23980,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
23980
23980
|
extraOffset += 1;
|
|
23981
23981
|
return "\\.";
|
|
23982
23982
|
}
|
|
23983
|
-
backtrack = slash || format ? "" :
|
|
23983
|
+
backtrack = slash || format ? "" : path8.slice(pos, offset);
|
|
23984
23984
|
if (match === "*") {
|
|
23985
23985
|
extraOffset += 3;
|
|
23986
23986
|
return "(.*)";
|
|
@@ -24006,7 +24006,7 @@ var require_path_to_regexp = __commonJS({
|
|
|
24006
24006
|
return result;
|
|
24007
24007
|
}
|
|
24008
24008
|
);
|
|
24009
|
-
while (m = MATCHING_GROUP_REGEXP.exec(
|
|
24009
|
+
while (m = MATCHING_GROUP_REGEXP.exec(path8)) {
|
|
24010
24010
|
if (m[0][0] === "\\")
|
|
24011
24011
|
continue;
|
|
24012
24012
|
if (keysOffset + i === keys.length || keys[keysOffset + i].offset > m.index) {
|
|
@@ -24019,13 +24019,13 @@ var require_path_to_regexp = __commonJS({
|
|
|
24019
24019
|
}
|
|
24020
24020
|
i++;
|
|
24021
24021
|
}
|
|
24022
|
-
|
|
24022
|
+
path8 += strict ? "" : path8[path8.length - 1] === "/" ? "?" : "/?";
|
|
24023
24023
|
if (end) {
|
|
24024
|
-
|
|
24025
|
-
} else if (
|
|
24026
|
-
|
|
24024
|
+
path8 += "$";
|
|
24025
|
+
} else if (path8[path8.length - 1] !== "/") {
|
|
24026
|
+
path8 += lookahead ? "(?=/|$)" : "(?:/|$)";
|
|
24027
24027
|
}
|
|
24028
|
-
return new RegExp("^" +
|
|
24028
|
+
return new RegExp("^" + path8, flags);
|
|
24029
24029
|
}
|
|
24030
24030
|
}
|
|
24031
24031
|
});
|
|
@@ -24038,19 +24038,19 @@ var require_layer = __commonJS({
|
|
|
24038
24038
|
var debug = require_src()("express:router:layer");
|
|
24039
24039
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
24040
24040
|
module.exports = Layer;
|
|
24041
|
-
function Layer(
|
|
24041
|
+
function Layer(path8, options, fn) {
|
|
24042
24042
|
if (!(this instanceof Layer)) {
|
|
24043
|
-
return new Layer(
|
|
24043
|
+
return new Layer(path8, options, fn);
|
|
24044
24044
|
}
|
|
24045
|
-
debug("new %o",
|
|
24045
|
+
debug("new %o", path8);
|
|
24046
24046
|
var opts = options || {};
|
|
24047
24047
|
this.handle = fn;
|
|
24048
24048
|
this.name = fn.name || "<anonymous>";
|
|
24049
24049
|
this.params = void 0;
|
|
24050
24050
|
this.path = void 0;
|
|
24051
|
-
this.regexp = pathRegexp(
|
|
24052
|
-
this.regexp.fast_star =
|
|
24053
|
-
this.regexp.fast_slash =
|
|
24051
|
+
this.regexp = pathRegexp(path8, this.keys = [], opts);
|
|
24052
|
+
this.regexp.fast_star = path8 === "*";
|
|
24053
|
+
this.regexp.fast_slash = path8 === "/" && opts.end === false;
|
|
24054
24054
|
}
|
|
24055
24055
|
Layer.prototype.handle_error = function handle_error(error, req, res, next) {
|
|
24056
24056
|
var fn = this.handle;
|
|
@@ -24074,20 +24074,20 @@ var require_layer = __commonJS({
|
|
|
24074
24074
|
next(err);
|
|
24075
24075
|
}
|
|
24076
24076
|
};
|
|
24077
|
-
Layer.prototype.match = function match(
|
|
24077
|
+
Layer.prototype.match = function match(path8) {
|
|
24078
24078
|
var match2;
|
|
24079
|
-
if (
|
|
24079
|
+
if (path8 != null) {
|
|
24080
24080
|
if (this.regexp.fast_slash) {
|
|
24081
24081
|
this.params = {};
|
|
24082
24082
|
this.path = "";
|
|
24083
24083
|
return true;
|
|
24084
24084
|
}
|
|
24085
24085
|
if (this.regexp.fast_star) {
|
|
24086
|
-
this.params = { "0": decode_param(
|
|
24087
|
-
this.path =
|
|
24086
|
+
this.params = { "0": decode_param(path8) };
|
|
24087
|
+
this.path = path8;
|
|
24088
24088
|
return true;
|
|
24089
24089
|
}
|
|
24090
|
-
match2 = this.regexp.exec(
|
|
24090
|
+
match2 = this.regexp.exec(path8);
|
|
24091
24091
|
}
|
|
24092
24092
|
if (!match2) {
|
|
24093
24093
|
this.params = void 0;
|
|
@@ -24180,10 +24180,10 @@ var require_route = __commonJS({
|
|
|
24180
24180
|
var slice = Array.prototype.slice;
|
|
24181
24181
|
var toString = Object.prototype.toString;
|
|
24182
24182
|
module.exports = Route;
|
|
24183
|
-
function Route(
|
|
24184
|
-
this.path =
|
|
24183
|
+
function Route(path8) {
|
|
24184
|
+
this.path = path8;
|
|
24185
24185
|
this.stack = [];
|
|
24186
|
-
debug("new %o",
|
|
24186
|
+
debug("new %o", path8);
|
|
24187
24187
|
this.methods = {};
|
|
24188
24188
|
}
|
|
24189
24189
|
Route.prototype._handles_method = function _handles_method(method) {
|
|
@@ -24396,8 +24396,8 @@ var require_router = __commonJS({
|
|
|
24396
24396
|
if (++sync > 100) {
|
|
24397
24397
|
return setImmediate(next, err);
|
|
24398
24398
|
}
|
|
24399
|
-
var
|
|
24400
|
-
if (
|
|
24399
|
+
var path8 = getPathname(req);
|
|
24400
|
+
if (path8 == null) {
|
|
24401
24401
|
return done(layerError);
|
|
24402
24402
|
}
|
|
24403
24403
|
var layer;
|
|
@@ -24405,7 +24405,7 @@ var require_router = __commonJS({
|
|
|
24405
24405
|
var route;
|
|
24406
24406
|
while (match !== true && idx < stack.length) {
|
|
24407
24407
|
layer = stack[idx++];
|
|
24408
|
-
match = matchLayer(layer,
|
|
24408
|
+
match = matchLayer(layer, path8);
|
|
24409
24409
|
route = layer.route;
|
|
24410
24410
|
if (typeof match !== "boolean") {
|
|
24411
24411
|
layerError = layerError || match;
|
|
@@ -24443,18 +24443,18 @@ var require_router = __commonJS({
|
|
|
24443
24443
|
} else if (route) {
|
|
24444
24444
|
layer.handle_request(req, res, next);
|
|
24445
24445
|
} else {
|
|
24446
|
-
trim_prefix(layer, layerError, layerPath,
|
|
24446
|
+
trim_prefix(layer, layerError, layerPath, path8);
|
|
24447
24447
|
}
|
|
24448
24448
|
sync = 0;
|
|
24449
24449
|
});
|
|
24450
24450
|
}
|
|
24451
|
-
function trim_prefix(layer, layerError, layerPath,
|
|
24451
|
+
function trim_prefix(layer, layerError, layerPath, path8) {
|
|
24452
24452
|
if (layerPath.length !== 0) {
|
|
24453
|
-
if (layerPath !==
|
|
24453
|
+
if (layerPath !== path8.slice(0, layerPath.length)) {
|
|
24454
24454
|
next(layerError);
|
|
24455
24455
|
return;
|
|
24456
24456
|
}
|
|
24457
|
-
var c =
|
|
24457
|
+
var c = path8[layerPath.length];
|
|
24458
24458
|
if (c && c !== "/" && c !== ".")
|
|
24459
24459
|
return next(layerError);
|
|
24460
24460
|
debug("trim prefix (%s) from url %s", layerPath, req.url);
|
|
@@ -24534,7 +24534,7 @@ var require_router = __commonJS({
|
|
|
24534
24534
|
};
|
|
24535
24535
|
proto.use = function use(fn) {
|
|
24536
24536
|
var offset = 0;
|
|
24537
|
-
var
|
|
24537
|
+
var path8 = "/";
|
|
24538
24538
|
if (typeof fn !== "function") {
|
|
24539
24539
|
var arg = fn;
|
|
24540
24540
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -24542,7 +24542,7 @@ var require_router = __commonJS({
|
|
|
24542
24542
|
}
|
|
24543
24543
|
if (typeof arg !== "function") {
|
|
24544
24544
|
offset = 1;
|
|
24545
|
-
|
|
24545
|
+
path8 = fn;
|
|
24546
24546
|
}
|
|
24547
24547
|
}
|
|
24548
24548
|
var callbacks = flatten(slice.call(arguments, offset));
|
|
@@ -24554,8 +24554,8 @@ var require_router = __commonJS({
|
|
|
24554
24554
|
if (typeof fn !== "function") {
|
|
24555
24555
|
throw new TypeError("Router.use() requires a middleware function but got a " + gettype(fn));
|
|
24556
24556
|
}
|
|
24557
|
-
debug("use %o %s",
|
|
24558
|
-
var layer = new Layer(
|
|
24557
|
+
debug("use %o %s", path8, fn.name || "<anonymous>");
|
|
24558
|
+
var layer = new Layer(path8, {
|
|
24559
24559
|
sensitive: this.caseSensitive,
|
|
24560
24560
|
strict: false,
|
|
24561
24561
|
end: false
|
|
@@ -24565,9 +24565,9 @@ var require_router = __commonJS({
|
|
|
24565
24565
|
}
|
|
24566
24566
|
return this;
|
|
24567
24567
|
};
|
|
24568
|
-
proto.route = function route(
|
|
24569
|
-
var route2 = new Route(
|
|
24570
|
-
var layer = new Layer(
|
|
24568
|
+
proto.route = function route(path8) {
|
|
24569
|
+
var route2 = new Route(path8);
|
|
24570
|
+
var layer = new Layer(path8, {
|
|
24571
24571
|
sensitive: this.caseSensitive,
|
|
24572
24572
|
strict: this.strict,
|
|
24573
24573
|
end: true
|
|
@@ -24577,8 +24577,8 @@ var require_router = __commonJS({
|
|
|
24577
24577
|
return route2;
|
|
24578
24578
|
};
|
|
24579
24579
|
methods.concat("all").forEach(function(method) {
|
|
24580
|
-
proto[method] = function(
|
|
24581
|
-
var route = this.route(
|
|
24580
|
+
proto[method] = function(path8) {
|
|
24581
|
+
var route = this.route(path8);
|
|
24582
24582
|
route[method].apply(route, slice.call(arguments, 1));
|
|
24583
24583
|
return this;
|
|
24584
24584
|
};
|
|
@@ -24614,9 +24614,9 @@ var require_router = __commonJS({
|
|
|
24614
24614
|
}
|
|
24615
24615
|
return toString.call(obj).replace(objectRegExp, "$1");
|
|
24616
24616
|
}
|
|
24617
|
-
function matchLayer(layer,
|
|
24617
|
+
function matchLayer(layer, path8) {
|
|
24618
24618
|
try {
|
|
24619
|
-
return layer.match(
|
|
24619
|
+
return layer.match(path8);
|
|
24620
24620
|
} catch (err) {
|
|
24621
24621
|
return err;
|
|
24622
24622
|
}
|
|
@@ -24735,13 +24735,13 @@ var require_view = __commonJS({
|
|
|
24735
24735
|
"node_modules/express/lib/view.js"(exports, module) {
|
|
24736
24736
|
"use strict";
|
|
24737
24737
|
var debug = require_src()("express:view");
|
|
24738
|
-
var
|
|
24738
|
+
var path8 = __require("path");
|
|
24739
24739
|
var fs4 = __require("fs");
|
|
24740
|
-
var dirname =
|
|
24741
|
-
var basename =
|
|
24742
|
-
var extname =
|
|
24743
|
-
var join =
|
|
24744
|
-
var resolve =
|
|
24740
|
+
var dirname = path8.dirname;
|
|
24741
|
+
var basename = path8.basename;
|
|
24742
|
+
var extname = path8.extname;
|
|
24743
|
+
var join = path8.join;
|
|
24744
|
+
var resolve = path8.resolve;
|
|
24745
24745
|
module.exports = View;
|
|
24746
24746
|
function View(name, options) {
|
|
24747
24747
|
var opts = options || {};
|
|
@@ -24770,17 +24770,17 @@ var require_view = __commonJS({
|
|
|
24770
24770
|
this.path = this.lookup(fileName);
|
|
24771
24771
|
}
|
|
24772
24772
|
View.prototype.lookup = function lookup(name) {
|
|
24773
|
-
var
|
|
24773
|
+
var path9;
|
|
24774
24774
|
var roots = [].concat(this.root);
|
|
24775
24775
|
debug('lookup "%s"', name);
|
|
24776
|
-
for (var i = 0; i < roots.length && !
|
|
24776
|
+
for (var i = 0; i < roots.length && !path9; i++) {
|
|
24777
24777
|
var root = roots[i];
|
|
24778
24778
|
var loc = resolve(root, name);
|
|
24779
24779
|
var dir = dirname(loc);
|
|
24780
24780
|
var file = basename(loc);
|
|
24781
|
-
|
|
24781
|
+
path9 = this.resolve(dir, file);
|
|
24782
24782
|
}
|
|
24783
|
-
return
|
|
24783
|
+
return path9;
|
|
24784
24784
|
};
|
|
24785
24785
|
View.prototype.render = function render(options, callback) {
|
|
24786
24786
|
debug('render "%s"', this.path);
|
|
@@ -24788,21 +24788,21 @@ var require_view = __commonJS({
|
|
|
24788
24788
|
};
|
|
24789
24789
|
View.prototype.resolve = function resolve2(dir, file) {
|
|
24790
24790
|
var ext = this.ext;
|
|
24791
|
-
var
|
|
24792
|
-
var stat = tryStat(
|
|
24791
|
+
var path9 = join(dir, file);
|
|
24792
|
+
var stat = tryStat(path9);
|
|
24793
24793
|
if (stat && stat.isFile()) {
|
|
24794
|
-
return
|
|
24794
|
+
return path9;
|
|
24795
24795
|
}
|
|
24796
|
-
|
|
24797
|
-
stat = tryStat(
|
|
24796
|
+
path9 = join(dir, basename(file, ext), "index" + ext);
|
|
24797
|
+
stat = tryStat(path9);
|
|
24798
24798
|
if (stat && stat.isFile()) {
|
|
24799
|
-
return
|
|
24799
|
+
return path9;
|
|
24800
24800
|
}
|
|
24801
24801
|
};
|
|
24802
|
-
function tryStat(
|
|
24803
|
-
debug('stat "%s"',
|
|
24802
|
+
function tryStat(path9) {
|
|
24803
|
+
debug('stat "%s"', path9);
|
|
24804
24804
|
try {
|
|
24805
|
-
return fs4.statSync(
|
|
24805
|
+
return fs4.statSync(path9);
|
|
24806
24806
|
} catch (e) {
|
|
24807
24807
|
return void 0;
|
|
24808
24808
|
}
|
|
@@ -25170,7 +25170,7 @@ var require_types = __commonJS({
|
|
|
25170
25170
|
// node_modules/mime/mime.js
|
|
25171
25171
|
var require_mime = __commonJS({
|
|
25172
25172
|
"node_modules/mime/mime.js"(exports, module) {
|
|
25173
|
-
var
|
|
25173
|
+
var path8 = __require("path");
|
|
25174
25174
|
var fs4 = __require("fs");
|
|
25175
25175
|
function Mime() {
|
|
25176
25176
|
this.types = /* @__PURE__ */ Object.create(null);
|
|
@@ -25200,8 +25200,8 @@ var require_mime = __commonJS({
|
|
|
25200
25200
|
this.define(map);
|
|
25201
25201
|
this._loading = null;
|
|
25202
25202
|
};
|
|
25203
|
-
Mime.prototype.lookup = function(
|
|
25204
|
-
var ext =
|
|
25203
|
+
Mime.prototype.lookup = function(path9, fallback) {
|
|
25204
|
+
var ext = path9.replace(/^.*[\.\/\\]/, "").toLowerCase();
|
|
25205
25205
|
return this.types[ext] || fallback || this.default_type;
|
|
25206
25206
|
};
|
|
25207
25207
|
Mime.prototype.extension = function(mimeType) {
|
|
@@ -25435,28 +25435,28 @@ var require_send = __commonJS({
|
|
|
25435
25435
|
var ms = require_ms2();
|
|
25436
25436
|
var onFinished = require_on_finished();
|
|
25437
25437
|
var parseRange = require_range_parser();
|
|
25438
|
-
var
|
|
25438
|
+
var path8 = __require("path");
|
|
25439
25439
|
var statuses = require_statuses();
|
|
25440
25440
|
var Stream = __require("stream");
|
|
25441
25441
|
var util = __require("util");
|
|
25442
|
-
var extname =
|
|
25443
|
-
var join =
|
|
25444
|
-
var normalize =
|
|
25445
|
-
var resolve =
|
|
25446
|
-
var sep =
|
|
25442
|
+
var extname = path8.extname;
|
|
25443
|
+
var join = path8.join;
|
|
25444
|
+
var normalize = path8.normalize;
|
|
25445
|
+
var resolve = path8.resolve;
|
|
25446
|
+
var sep = path8.sep;
|
|
25447
25447
|
var BYTES_RANGE_REGEXP = /^ *bytes=/;
|
|
25448
25448
|
var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
|
|
25449
25449
|
var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
|
|
25450
25450
|
module.exports = send;
|
|
25451
25451
|
module.exports.mime = mime;
|
|
25452
|
-
function send(req,
|
|
25453
|
-
return new SendStream(req,
|
|
25452
|
+
function send(req, path9, options) {
|
|
25453
|
+
return new SendStream(req, path9, options);
|
|
25454
25454
|
}
|
|
25455
|
-
function SendStream(req,
|
|
25455
|
+
function SendStream(req, path9, options) {
|
|
25456
25456
|
Stream.call(this);
|
|
25457
25457
|
var opts = options || {};
|
|
25458
25458
|
this.options = opts;
|
|
25459
|
-
this.path =
|
|
25459
|
+
this.path = path9;
|
|
25460
25460
|
this.req = req;
|
|
25461
25461
|
this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
|
|
25462
25462
|
this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
|
|
@@ -25502,8 +25502,8 @@ var require_send = __commonJS({
|
|
|
25502
25502
|
this._index = index2;
|
|
25503
25503
|
return this;
|
|
25504
25504
|
}, "send.index: pass index as option");
|
|
25505
|
-
SendStream.prototype.root = function root(
|
|
25506
|
-
this._root = resolve(String(
|
|
25505
|
+
SendStream.prototype.root = function root(path9) {
|
|
25506
|
+
this._root = resolve(String(path9));
|
|
25507
25507
|
debug("root %s", this._root);
|
|
25508
25508
|
return this;
|
|
25509
25509
|
};
|
|
@@ -25616,10 +25616,10 @@ var require_send = __commonJS({
|
|
|
25616
25616
|
var lastModified = this.res.getHeader("Last-Modified");
|
|
25617
25617
|
return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
|
|
25618
25618
|
};
|
|
25619
|
-
SendStream.prototype.redirect = function redirect(
|
|
25619
|
+
SendStream.prototype.redirect = function redirect(path9) {
|
|
25620
25620
|
var res = this.res;
|
|
25621
25621
|
if (hasListeners(this, "directory")) {
|
|
25622
|
-
this.emit("directory", res,
|
|
25622
|
+
this.emit("directory", res, path9);
|
|
25623
25623
|
return;
|
|
25624
25624
|
}
|
|
25625
25625
|
if (this.hasTrailingSlash()) {
|
|
@@ -25639,42 +25639,42 @@ var require_send = __commonJS({
|
|
|
25639
25639
|
SendStream.prototype.pipe = function pipe(res) {
|
|
25640
25640
|
var root = this._root;
|
|
25641
25641
|
this.res = res;
|
|
25642
|
-
var
|
|
25643
|
-
if (
|
|
25642
|
+
var path9 = decode(this.path);
|
|
25643
|
+
if (path9 === -1) {
|
|
25644
25644
|
this.error(400);
|
|
25645
25645
|
return res;
|
|
25646
25646
|
}
|
|
25647
|
-
if (~
|
|
25647
|
+
if (~path9.indexOf("\0")) {
|
|
25648
25648
|
this.error(400);
|
|
25649
25649
|
return res;
|
|
25650
25650
|
}
|
|
25651
25651
|
var parts;
|
|
25652
25652
|
if (root !== null) {
|
|
25653
|
-
if (
|
|
25654
|
-
|
|
25653
|
+
if (path9) {
|
|
25654
|
+
path9 = normalize("." + sep + path9);
|
|
25655
25655
|
}
|
|
25656
|
-
if (UP_PATH_REGEXP.test(
|
|
25657
|
-
debug('malicious path "%s"',
|
|
25656
|
+
if (UP_PATH_REGEXP.test(path9)) {
|
|
25657
|
+
debug('malicious path "%s"', path9);
|
|
25658
25658
|
this.error(403);
|
|
25659
25659
|
return res;
|
|
25660
25660
|
}
|
|
25661
|
-
parts =
|
|
25662
|
-
|
|
25661
|
+
parts = path9.split(sep);
|
|
25662
|
+
path9 = normalize(join(root, path9));
|
|
25663
25663
|
} else {
|
|
25664
|
-
if (UP_PATH_REGEXP.test(
|
|
25665
|
-
debug('malicious path "%s"',
|
|
25664
|
+
if (UP_PATH_REGEXP.test(path9)) {
|
|
25665
|
+
debug('malicious path "%s"', path9);
|
|
25666
25666
|
this.error(403);
|
|
25667
25667
|
return res;
|
|
25668
25668
|
}
|
|
25669
|
-
parts = normalize(
|
|
25670
|
-
|
|
25669
|
+
parts = normalize(path9).split(sep);
|
|
25670
|
+
path9 = resolve(path9);
|
|
25671
25671
|
}
|
|
25672
25672
|
if (containsDotFile(parts)) {
|
|
25673
25673
|
var access = this._dotfiles;
|
|
25674
25674
|
if (access === void 0) {
|
|
25675
25675
|
access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
|
|
25676
25676
|
}
|
|
25677
|
-
debug('%s dotfile "%s"', access,
|
|
25677
|
+
debug('%s dotfile "%s"', access, path9);
|
|
25678
25678
|
switch (access) {
|
|
25679
25679
|
case "allow":
|
|
25680
25680
|
break;
|
|
@@ -25688,13 +25688,13 @@ var require_send = __commonJS({
|
|
|
25688
25688
|
}
|
|
25689
25689
|
}
|
|
25690
25690
|
if (this._index.length && this.hasTrailingSlash()) {
|
|
25691
|
-
this.sendIndex(
|
|
25691
|
+
this.sendIndex(path9);
|
|
25692
25692
|
return res;
|
|
25693
25693
|
}
|
|
25694
|
-
this.sendFile(
|
|
25694
|
+
this.sendFile(path9);
|
|
25695
25695
|
return res;
|
|
25696
25696
|
};
|
|
25697
|
-
SendStream.prototype.send = function send2(
|
|
25697
|
+
SendStream.prototype.send = function send2(path9, stat) {
|
|
25698
25698
|
var len = stat.size;
|
|
25699
25699
|
var options = this.options;
|
|
25700
25700
|
var opts = {};
|
|
@@ -25706,9 +25706,9 @@ var require_send = __commonJS({
|
|
|
25706
25706
|
this.headersAlreadySent();
|
|
25707
25707
|
return;
|
|
25708
25708
|
}
|
|
25709
|
-
debug('pipe "%s"',
|
|
25710
|
-
this.setHeader(
|
|
25711
|
-
this.type(
|
|
25709
|
+
debug('pipe "%s"', path9);
|
|
25710
|
+
this.setHeader(path9, stat);
|
|
25711
|
+
this.type(path9);
|
|
25712
25712
|
if (this.isConditionalGET()) {
|
|
25713
25713
|
if (this.isPreconditionFailure()) {
|
|
25714
25714
|
this.error(412);
|
|
@@ -25758,28 +25758,28 @@ var require_send = __commonJS({
|
|
|
25758
25758
|
res.end();
|
|
25759
25759
|
return;
|
|
25760
25760
|
}
|
|
25761
|
-
this.stream(
|
|
25761
|
+
this.stream(path9, opts);
|
|
25762
25762
|
};
|
|
25763
|
-
SendStream.prototype.sendFile = function sendFile(
|
|
25763
|
+
SendStream.prototype.sendFile = function sendFile(path9) {
|
|
25764
25764
|
var i = 0;
|
|
25765
25765
|
var self = this;
|
|
25766
|
-
debug('stat "%s"',
|
|
25767
|
-
fs4.stat(
|
|
25768
|
-
if (err && err.code === "ENOENT" && !extname(
|
|
25766
|
+
debug('stat "%s"', path9);
|
|
25767
|
+
fs4.stat(path9, function onstat(err, stat) {
|
|
25768
|
+
if (err && err.code === "ENOENT" && !extname(path9) && path9[path9.length - 1] !== sep) {
|
|
25769
25769
|
return next(err);
|
|
25770
25770
|
}
|
|
25771
25771
|
if (err)
|
|
25772
25772
|
return self.onStatError(err);
|
|
25773
25773
|
if (stat.isDirectory())
|
|
25774
|
-
return self.redirect(
|
|
25775
|
-
self.emit("file",
|
|
25776
|
-
self.send(
|
|
25774
|
+
return self.redirect(path9);
|
|
25775
|
+
self.emit("file", path9, stat);
|
|
25776
|
+
self.send(path9, stat);
|
|
25777
25777
|
});
|
|
25778
25778
|
function next(err) {
|
|
25779
25779
|
if (self._extensions.length <= i) {
|
|
25780
25780
|
return err ? self.onStatError(err) : self.error(404);
|
|
25781
25781
|
}
|
|
25782
|
-
var p =
|
|
25782
|
+
var p = path9 + "." + self._extensions[i++];
|
|
25783
25783
|
debug('stat "%s"', p);
|
|
25784
25784
|
fs4.stat(p, function(err2, stat) {
|
|
25785
25785
|
if (err2)
|
|
@@ -25791,7 +25791,7 @@ var require_send = __commonJS({
|
|
|
25791
25791
|
});
|
|
25792
25792
|
}
|
|
25793
25793
|
};
|
|
25794
|
-
SendStream.prototype.sendIndex = function sendIndex(
|
|
25794
|
+
SendStream.prototype.sendIndex = function sendIndex(path9) {
|
|
25795
25795
|
var i = -1;
|
|
25796
25796
|
var self = this;
|
|
25797
25797
|
function next(err) {
|
|
@@ -25800,7 +25800,7 @@ var require_send = __commonJS({
|
|
|
25800
25800
|
return self.onStatError(err);
|
|
25801
25801
|
return self.error(404);
|
|
25802
25802
|
}
|
|
25803
|
-
var p = join(
|
|
25803
|
+
var p = join(path9, self._index[i]);
|
|
25804
25804
|
debug('stat "%s"', p);
|
|
25805
25805
|
fs4.stat(p, function(err2, stat) {
|
|
25806
25806
|
if (err2)
|
|
@@ -25813,10 +25813,10 @@ var require_send = __commonJS({
|
|
|
25813
25813
|
}
|
|
25814
25814
|
next();
|
|
25815
25815
|
};
|
|
25816
|
-
SendStream.prototype.stream = function stream(
|
|
25816
|
+
SendStream.prototype.stream = function stream(path9, options) {
|
|
25817
25817
|
var self = this;
|
|
25818
25818
|
var res = this.res;
|
|
25819
|
-
var stream2 = fs4.createReadStream(
|
|
25819
|
+
var stream2 = fs4.createReadStream(path9, options);
|
|
25820
25820
|
this.emit("stream", stream2);
|
|
25821
25821
|
stream2.pipe(res);
|
|
25822
25822
|
function cleanup() {
|
|
@@ -25831,11 +25831,11 @@ var require_send = __commonJS({
|
|
|
25831
25831
|
self.emit("end");
|
|
25832
25832
|
});
|
|
25833
25833
|
};
|
|
25834
|
-
SendStream.prototype.type = function type(
|
|
25834
|
+
SendStream.prototype.type = function type(path9) {
|
|
25835
25835
|
var res = this.res;
|
|
25836
25836
|
if (res.getHeader("Content-Type"))
|
|
25837
25837
|
return;
|
|
25838
|
-
var type2 = mime.lookup(
|
|
25838
|
+
var type2 = mime.lookup(path9);
|
|
25839
25839
|
if (!type2) {
|
|
25840
25840
|
debug("no content-type");
|
|
25841
25841
|
return;
|
|
@@ -25844,9 +25844,9 @@ var require_send = __commonJS({
|
|
|
25844
25844
|
debug("content-type %s", type2);
|
|
25845
25845
|
res.setHeader("Content-Type", type2 + (charset ? "; charset=" + charset : ""));
|
|
25846
25846
|
};
|
|
25847
|
-
SendStream.prototype.setHeader = function setHeader(
|
|
25847
|
+
SendStream.prototype.setHeader = function setHeader(path9, stat) {
|
|
25848
25848
|
var res = this.res;
|
|
25849
|
-
this.emit("headers", res,
|
|
25849
|
+
this.emit("headers", res, path9, stat);
|
|
25850
25850
|
if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
|
|
25851
25851
|
debug("accept ranges");
|
|
25852
25852
|
res.setHeader("Accept-Ranges", "bytes");
|
|
@@ -25905,9 +25905,9 @@ var require_send = __commonJS({
|
|
|
25905
25905
|
}
|
|
25906
25906
|
return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
|
|
25907
25907
|
}
|
|
25908
|
-
function decode(
|
|
25908
|
+
function decode(path9) {
|
|
25909
25909
|
try {
|
|
25910
|
-
return decodeURIComponent(
|
|
25910
|
+
return decodeURIComponent(path9);
|
|
25911
25911
|
} catch (err) {
|
|
25912
25912
|
return -1;
|
|
25913
25913
|
}
|
|
@@ -26819,12 +26819,12 @@ var require_utils3 = __commonJS({
|
|
|
26819
26819
|
var querystring = __require("querystring");
|
|
26820
26820
|
exports.etag = createETagGenerator({ weak: false });
|
|
26821
26821
|
exports.wetag = createETagGenerator({ weak: true });
|
|
26822
|
-
exports.isAbsolute = function(
|
|
26823
|
-
if ("/" ===
|
|
26822
|
+
exports.isAbsolute = function(path8) {
|
|
26823
|
+
if ("/" === path8[0])
|
|
26824
26824
|
return true;
|
|
26825
|
-
if (":" ===
|
|
26825
|
+
if (":" === path8[1] && ("\\" === path8[2] || "/" === path8[2]))
|
|
26826
26826
|
return true;
|
|
26827
|
-
if ("\\\\" ===
|
|
26827
|
+
if ("\\\\" === path8.substring(0, 2))
|
|
26828
26828
|
return true;
|
|
26829
26829
|
};
|
|
26830
26830
|
exports.flatten = deprecate.function(
|
|
@@ -27037,7 +27037,7 @@ var require_application = __commonJS({
|
|
|
27037
27037
|
};
|
|
27038
27038
|
app.use = function use(fn) {
|
|
27039
27039
|
var offset = 0;
|
|
27040
|
-
var
|
|
27040
|
+
var path8 = "/";
|
|
27041
27041
|
if (typeof fn !== "function") {
|
|
27042
27042
|
var arg = fn;
|
|
27043
27043
|
while (Array.isArray(arg) && arg.length !== 0) {
|
|
@@ -27045,7 +27045,7 @@ var require_application = __commonJS({
|
|
|
27045
27045
|
}
|
|
27046
27046
|
if (typeof arg !== "function") {
|
|
27047
27047
|
offset = 1;
|
|
27048
|
-
|
|
27048
|
+
path8 = fn;
|
|
27049
27049
|
}
|
|
27050
27050
|
}
|
|
27051
27051
|
var fns = flatten(slice.call(arguments, offset));
|
|
@@ -27056,12 +27056,12 @@ var require_application = __commonJS({
|
|
|
27056
27056
|
var router = this._router;
|
|
27057
27057
|
fns.forEach(function(fn2) {
|
|
27058
27058
|
if (!fn2 || !fn2.handle || !fn2.set) {
|
|
27059
|
-
return router.use(
|
|
27059
|
+
return router.use(path8, fn2);
|
|
27060
27060
|
}
|
|
27061
|
-
debug(".use app under %s",
|
|
27062
|
-
fn2.mountpath =
|
|
27061
|
+
debug(".use app under %s", path8);
|
|
27062
|
+
fn2.mountpath = path8;
|
|
27063
27063
|
fn2.parent = this;
|
|
27064
|
-
router.use(
|
|
27064
|
+
router.use(path8, function mounted_app(req, res, next) {
|
|
27065
27065
|
var orig = req.app;
|
|
27066
27066
|
fn2.handle(req, res, function(err) {
|
|
27067
27067
|
setPrototypeOf(req, orig.request);
|
|
@@ -27073,9 +27073,9 @@ var require_application = __commonJS({
|
|
|
27073
27073
|
}, this);
|
|
27074
27074
|
return this;
|
|
27075
27075
|
};
|
|
27076
|
-
app.route = function route(
|
|
27076
|
+
app.route = function route(path8) {
|
|
27077
27077
|
this.lazyrouter();
|
|
27078
|
-
return this._router.route(
|
|
27078
|
+
return this._router.route(path8);
|
|
27079
27079
|
};
|
|
27080
27080
|
app.engine = function engine(ext, fn) {
|
|
27081
27081
|
if (typeof fn !== "function") {
|
|
@@ -27126,7 +27126,7 @@ var require_application = __commonJS({
|
|
|
27126
27126
|
}
|
|
27127
27127
|
return this;
|
|
27128
27128
|
};
|
|
27129
|
-
app.path = function
|
|
27129
|
+
app.path = function path8() {
|
|
27130
27130
|
return this.parent ? this.parent.path() + this.mountpath : "";
|
|
27131
27131
|
};
|
|
27132
27132
|
app.enabled = function enabled(setting) {
|
|
@@ -27142,19 +27142,19 @@ var require_application = __commonJS({
|
|
|
27142
27142
|
return this.set(setting, false);
|
|
27143
27143
|
};
|
|
27144
27144
|
methods.forEach(function(method) {
|
|
27145
|
-
app[method] = function(
|
|
27145
|
+
app[method] = function(path8) {
|
|
27146
27146
|
if (method === "get" && arguments.length === 1) {
|
|
27147
|
-
return this.set(
|
|
27147
|
+
return this.set(path8);
|
|
27148
27148
|
}
|
|
27149
27149
|
this.lazyrouter();
|
|
27150
|
-
var route = this._router.route(
|
|
27150
|
+
var route = this._router.route(path8);
|
|
27151
27151
|
route[method].apply(route, slice.call(arguments, 1));
|
|
27152
27152
|
return this;
|
|
27153
27153
|
};
|
|
27154
27154
|
});
|
|
27155
|
-
app.all = function all(
|
|
27155
|
+
app.all = function all(path8) {
|
|
27156
27156
|
this.lazyrouter();
|
|
27157
|
-
var route = this._router.route(
|
|
27157
|
+
var route = this._router.route(path8);
|
|
27158
27158
|
var args = slice.call(arguments, 1);
|
|
27159
27159
|
for (var i = 0; i < methods.length; i++) {
|
|
27160
27160
|
route[methods[i]].apply(route, args);
|
|
@@ -27926,7 +27926,7 @@ var require_request = __commonJS({
|
|
|
27926
27926
|
var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
|
|
27927
27927
|
return subdomains2.slice(offset);
|
|
27928
27928
|
});
|
|
27929
|
-
defineGetter(req, "path", function
|
|
27929
|
+
defineGetter(req, "path", function path8() {
|
|
27930
27930
|
return parse(this).pathname;
|
|
27931
27931
|
});
|
|
27932
27932
|
defineGetter(req, "hostname", function hostname() {
|
|
@@ -28258,7 +28258,7 @@ var require_response = __commonJS({
|
|
|
28258
28258
|
var http = __require("http");
|
|
28259
28259
|
var isAbsolute = require_utils3().isAbsolute;
|
|
28260
28260
|
var onFinished = require_on_finished();
|
|
28261
|
-
var
|
|
28261
|
+
var path8 = __require("path");
|
|
28262
28262
|
var statuses = require_statuses();
|
|
28263
28263
|
var merge = require_utils_merge();
|
|
28264
28264
|
var sign = require_cookie_signature().sign;
|
|
@@ -28267,9 +28267,9 @@ var require_response = __commonJS({
|
|
|
28267
28267
|
var setCharset = require_utils3().setCharset;
|
|
28268
28268
|
var cookie = require_cookie();
|
|
28269
28269
|
var send = require_send();
|
|
28270
|
-
var extname =
|
|
28270
|
+
var extname = path8.extname;
|
|
28271
28271
|
var mime = send.mime;
|
|
28272
|
-
var resolve =
|
|
28272
|
+
var resolve = path8.resolve;
|
|
28273
28273
|
var vary = require_vary();
|
|
28274
28274
|
var res = Object.create(http.ServerResponse.prototype);
|
|
28275
28275
|
module.exports = res;
|
|
@@ -28447,26 +28447,26 @@ var require_response = __commonJS({
|
|
|
28447
28447
|
this.type("txt");
|
|
28448
28448
|
return this.send(body);
|
|
28449
28449
|
};
|
|
28450
|
-
res.sendFile = function sendFile(
|
|
28450
|
+
res.sendFile = function sendFile(path9, options, callback) {
|
|
28451
28451
|
var done = callback;
|
|
28452
28452
|
var req = this.req;
|
|
28453
28453
|
var res2 = this;
|
|
28454
28454
|
var next = req.next;
|
|
28455
28455
|
var opts = options || {};
|
|
28456
|
-
if (!
|
|
28456
|
+
if (!path9) {
|
|
28457
28457
|
throw new TypeError("path argument is required to res.sendFile");
|
|
28458
28458
|
}
|
|
28459
|
-
if (typeof
|
|
28459
|
+
if (typeof path9 !== "string") {
|
|
28460
28460
|
throw new TypeError("path must be a string to res.sendFile");
|
|
28461
28461
|
}
|
|
28462
28462
|
if (typeof options === "function") {
|
|
28463
28463
|
done = options;
|
|
28464
28464
|
opts = {};
|
|
28465
28465
|
}
|
|
28466
|
-
if (!opts.root && !isAbsolute(
|
|
28466
|
+
if (!opts.root && !isAbsolute(path9)) {
|
|
28467
28467
|
throw new TypeError("path must be absolute or specify root to res.sendFile");
|
|
28468
28468
|
}
|
|
28469
|
-
var pathname = encodeURI(
|
|
28469
|
+
var pathname = encodeURI(path9);
|
|
28470
28470
|
var file = send(req, pathname, opts);
|
|
28471
28471
|
sendfile(res2, file, opts, function(err) {
|
|
28472
28472
|
if (done)
|
|
@@ -28478,7 +28478,7 @@ var require_response = __commonJS({
|
|
|
28478
28478
|
}
|
|
28479
28479
|
});
|
|
28480
28480
|
};
|
|
28481
|
-
res.sendfile = function(
|
|
28481
|
+
res.sendfile = function(path9, options, callback) {
|
|
28482
28482
|
var done = callback;
|
|
28483
28483
|
var req = this.req;
|
|
28484
28484
|
var res2 = this;
|
|
@@ -28488,7 +28488,7 @@ var require_response = __commonJS({
|
|
|
28488
28488
|
done = options;
|
|
28489
28489
|
opts = {};
|
|
28490
28490
|
}
|
|
28491
|
-
var file = send(req,
|
|
28491
|
+
var file = send(req, path9, opts);
|
|
28492
28492
|
sendfile(res2, file, opts, function(err) {
|
|
28493
28493
|
if (done)
|
|
28494
28494
|
return done(err);
|
|
@@ -28503,7 +28503,7 @@ var require_response = __commonJS({
|
|
|
28503
28503
|
res.sendfile,
|
|
28504
28504
|
"res.sendfile: Use res.sendFile instead"
|
|
28505
28505
|
);
|
|
28506
|
-
res.download = function download(
|
|
28506
|
+
res.download = function download(path9, filename, options, callback) {
|
|
28507
28507
|
var done = callback;
|
|
28508
28508
|
var name = filename;
|
|
28509
28509
|
var opts = options || null;
|
|
@@ -28520,7 +28520,7 @@ var require_response = __commonJS({
|
|
|
28520
28520
|
opts = filename;
|
|
28521
28521
|
}
|
|
28522
28522
|
var headers = {
|
|
28523
|
-
"Content-Disposition": contentDisposition(name ||
|
|
28523
|
+
"Content-Disposition": contentDisposition(name || path9)
|
|
28524
28524
|
};
|
|
28525
28525
|
if (opts && opts.headers) {
|
|
28526
28526
|
var keys = Object.keys(opts.headers);
|
|
@@ -28533,7 +28533,7 @@ var require_response = __commonJS({
|
|
|
28533
28533
|
}
|
|
28534
28534
|
opts = Object.create(opts);
|
|
28535
28535
|
opts.headers = headers;
|
|
28536
|
-
var fullPath = !opts.root ? resolve(
|
|
28536
|
+
var fullPath = !opts.root ? resolve(path9) : path9;
|
|
28537
28537
|
return this.sendFile(fullPath, opts, done);
|
|
28538
28538
|
};
|
|
28539
28539
|
res.contentType = res.type = function contentType(type) {
|
|
@@ -28843,11 +28843,11 @@ var require_serve_static = __commonJS({
|
|
|
28843
28843
|
}
|
|
28844
28844
|
var forwardError = !fallthrough;
|
|
28845
28845
|
var originalUrl = parseUrl.original(req);
|
|
28846
|
-
var
|
|
28847
|
-
if (
|
|
28848
|
-
|
|
28846
|
+
var path8 = parseUrl(req).pathname;
|
|
28847
|
+
if (path8 === "/" && originalUrl.pathname.substr(-1) !== "/") {
|
|
28848
|
+
path8 = "";
|
|
28849
28849
|
}
|
|
28850
|
-
var stream = send(req,
|
|
28850
|
+
var stream = send(req, path8, opts);
|
|
28851
28851
|
stream.on("directory", onDirectory);
|
|
28852
28852
|
if (setHeaders) {
|
|
28853
28853
|
stream.on("headers", setHeaders);
|
|
@@ -29034,20 +29034,22 @@ import path3 from "path";
|
|
|
29034
29034
|
function groupResults(config, results) {
|
|
29035
29035
|
if (config.showProject) {
|
|
29036
29036
|
const groupedResults = results.reduce((acc, result, index) => {
|
|
29037
|
+
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
|
29037
29038
|
const { filePath, suite, projectName } = result;
|
|
29038
29039
|
acc[filePath] = acc[filePath] || {};
|
|
29039
29040
|
acc[filePath][suite] = acc[filePath][suite] || {};
|
|
29040
29041
|
acc[filePath][suite][projectName] = acc[filePath][suite][projectName] || [];
|
|
29041
|
-
acc[filePath][suite][projectName].push({ ...result, index });
|
|
29042
|
+
acc[filePath][suite][projectName].push({ ...result, index, testId });
|
|
29042
29043
|
return acc;
|
|
29043
29044
|
}, {});
|
|
29044
29045
|
return groupedResults;
|
|
29045
29046
|
} else {
|
|
29046
29047
|
const groupedResults = results.reduce((acc, result, index) => {
|
|
29048
|
+
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
|
29047
29049
|
const { filePath, suite } = result;
|
|
29048
29050
|
acc[filePath] = acc[filePath] || {};
|
|
29049
29051
|
acc[filePath][suite] = acc[filePath][suite] || [];
|
|
29050
|
-
acc[filePath][suite].push({ ...result, index });
|
|
29052
|
+
acc[filePath][suite].push({ ...result, index, testId });
|
|
29051
29053
|
return acc;
|
|
29052
29054
|
}, {});
|
|
29053
29055
|
return groupedResults;
|
|
@@ -29125,23 +29127,41 @@ function escapeHtml(unsafe) {
|
|
|
29125
29127
|
return escapeMap[match] || match;
|
|
29126
29128
|
});
|
|
29127
29129
|
}
|
|
29130
|
+
function formatDateUTC(date) {
|
|
29131
|
+
return date.toISOString();
|
|
29132
|
+
}
|
|
29133
|
+
function formatDateLocal(isoString) {
|
|
29134
|
+
const date = new Date(isoString);
|
|
29135
|
+
const options = {
|
|
29136
|
+
year: "numeric",
|
|
29137
|
+
month: "short",
|
|
29138
|
+
day: "2-digit",
|
|
29139
|
+
hour: "2-digit",
|
|
29140
|
+
minute: "2-digit",
|
|
29141
|
+
// second: '2-digit',
|
|
29142
|
+
hour12: true,
|
|
29143
|
+
timeZoneName: "short"
|
|
29144
|
+
};
|
|
29145
|
+
return new Intl.DateTimeFormat(void 0, options).format(date);
|
|
29146
|
+
}
|
|
29128
29147
|
|
|
29129
29148
|
// src/helpers/HTMLGenerator.ts
|
|
29130
29149
|
var import_handlebars = __toESM(require_lib());
|
|
29131
29150
|
import fs2 from "fs";
|
|
29132
29151
|
var HTMLGenerator = class {
|
|
29133
|
-
constructor(ortoniConfig) {
|
|
29152
|
+
constructor(ortoniConfig, dbManager) {
|
|
29134
29153
|
this.ortoniConfig = ortoniConfig;
|
|
29135
29154
|
this.registerHandlebarsHelpers();
|
|
29136
29155
|
this.registerPartials();
|
|
29156
|
+
this.dbManager = dbManager;
|
|
29137
29157
|
}
|
|
29138
|
-
generateHTML(filteredResults, totalDuration, cssContent, results, projectSet) {
|
|
29139
|
-
const data = this.prepareReportData(filteredResults, totalDuration, results, projectSet);
|
|
29158
|
+
async generateHTML(filteredResults, totalDuration, cssContent, results, projectSet) {
|
|
29159
|
+
const data = await this.prepareReportData(filteredResults, totalDuration, results, projectSet);
|
|
29140
29160
|
const templateSource = fs2.readFileSync(path3.resolve(__dirname, "views", "main.hbs"), "utf-8");
|
|
29141
29161
|
const template = import_handlebars.default.compile(templateSource);
|
|
29142
29162
|
return template({ ...data, inlineCss: cssContent });
|
|
29143
29163
|
}
|
|
29144
|
-
prepareReportData(filteredResults, totalDuration, results, projectSet) {
|
|
29164
|
+
async prepareReportData(filteredResults, totalDuration, results, projectSet) {
|
|
29145
29165
|
const totalTests = filteredResults.length;
|
|
29146
29166
|
const passedTests = results.filter((r) => r.status === "passed").length;
|
|
29147
29167
|
const flakyTests = results.filter((r) => r.flaky === "flaky").length;
|
|
@@ -29150,7 +29170,20 @@ var HTMLGenerator = class {
|
|
|
29150
29170
|
const allTags = /* @__PURE__ */ new Set();
|
|
29151
29171
|
results.forEach((result) => result.testTags.forEach((tag) => allTags.add(tag)));
|
|
29152
29172
|
const projectResults = this.calculateProjectResults(filteredResults, results, projectSet);
|
|
29173
|
+
const utcRunDate = formatDateUTC(/* @__PURE__ */ new Date());
|
|
29174
|
+
const localRunDate = formatDateLocal(utcRunDate);
|
|
29175
|
+
const testHistories = await Promise.all(results.map(async (result) => {
|
|
29176
|
+
const testId = `${result.filePath}:${result.projectName}:${result.title}`;
|
|
29177
|
+
const history = await this.dbManager.getTestHistory(testId);
|
|
29178
|
+
return {
|
|
29179
|
+
testId,
|
|
29180
|
+
history
|
|
29181
|
+
};
|
|
29182
|
+
}));
|
|
29153
29183
|
return {
|
|
29184
|
+
utcRunDate,
|
|
29185
|
+
localRunDate,
|
|
29186
|
+
testHistories,
|
|
29154
29187
|
logo: this.ortoniConfig.logo || void 0,
|
|
29155
29188
|
totalDuration,
|
|
29156
29189
|
results,
|
|
@@ -29202,13 +29235,18 @@ var HTMLGenerator = class {
|
|
|
29202
29235
|
import_handlebars.default.registerHelper("joinWithSpace", (array) => array.join(" "));
|
|
29203
29236
|
import_handlebars.default.registerHelper("json", (context) => safeStringify(context));
|
|
29204
29237
|
import_handlebars.default.registerHelper("eq", (actualStatus, expectedStatus) => actualStatus === expectedStatus);
|
|
29238
|
+
import_handlebars.default.registerHelper("includes", (actualStatus, expectedStatus) => actualStatus.includes(expectedStatus));
|
|
29205
29239
|
import_handlebars.default.registerHelper("gr", (count) => count > 0);
|
|
29206
29240
|
import_handlebars.default.registerHelper("or", function(a, b) {
|
|
29207
29241
|
return a || b;
|
|
29208
29242
|
});
|
|
29243
|
+
import_handlebars.default.registerHelper("concat", function(...args) {
|
|
29244
|
+
args.pop();
|
|
29245
|
+
return args.join("");
|
|
29246
|
+
});
|
|
29209
29247
|
}
|
|
29210
29248
|
registerPartials() {
|
|
29211
|
-
["
|
|
29249
|
+
["head", "navbar", "testPanel", "summaryCard", "userInfo", "project", "testStatus", "testIcons"].forEach((partialName) => {
|
|
29212
29250
|
import_handlebars.default.registerPartial(partialName, fs2.readFileSync(
|
|
29213
29251
|
path3.resolve(__dirname, "views", `${partialName}.hbs`),
|
|
29214
29252
|
"utf-8"
|
|
@@ -29338,7 +29376,7 @@ var TestResultProcessor = class {
|
|
|
29338
29376
|
var import_express = __toESM(require_express2());
|
|
29339
29377
|
import path6 from "path";
|
|
29340
29378
|
import { spawn } from "child_process";
|
|
29341
|
-
function startReportServer(reportFolder, reportFilename, port = 2004,
|
|
29379
|
+
function startReportServer(reportFolder, reportFilename, port = 2004, open2) {
|
|
29342
29380
|
const app = (0, import_express.default)();
|
|
29343
29381
|
app.use(import_express.default.static(reportFolder));
|
|
29344
29382
|
app.get("/", (_req, res) => {
|
|
@@ -29353,7 +29391,7 @@ function startReportServer(reportFolder, reportFilename, port = 2004, open) {
|
|
|
29353
29391
|
const server = app.listen(port, () => {
|
|
29354
29392
|
console.log(`Server is running at http://localhost:${port}
|
|
29355
29393
|
Press Ctrl+C to stop.`);
|
|
29356
|
-
if (
|
|
29394
|
+
if (open2 === "always" || open2 === "on-failure") {
|
|
29357
29395
|
try {
|
|
29358
29396
|
openBrowser(`http://localhost:${port}`);
|
|
29359
29397
|
} catch (error) {
|
|
@@ -29405,26 +29443,157 @@ var ServerManager = class {
|
|
|
29405
29443
|
}
|
|
29406
29444
|
};
|
|
29407
29445
|
|
|
29446
|
+
// src/helpers/databaseManager.ts
|
|
29447
|
+
import { open } from "sqlite";
|
|
29448
|
+
import sqlite3 from "sqlite3";
|
|
29449
|
+
var DatabaseManager = class {
|
|
29450
|
+
constructor() {
|
|
29451
|
+
this.db = null;
|
|
29452
|
+
}
|
|
29453
|
+
async initialize(dbPath) {
|
|
29454
|
+
try {
|
|
29455
|
+
this.db = await open({
|
|
29456
|
+
filename: dbPath,
|
|
29457
|
+
driver: sqlite3.Database
|
|
29458
|
+
});
|
|
29459
|
+
await this.createTables();
|
|
29460
|
+
} catch (error) {
|
|
29461
|
+
console.error("OrtoniReport: Error initializing database:", error);
|
|
29462
|
+
}
|
|
29463
|
+
}
|
|
29464
|
+
async createTables() {
|
|
29465
|
+
if (!this.db) {
|
|
29466
|
+
console.error("OrtoniReport: Database not initialized");
|
|
29467
|
+
return;
|
|
29468
|
+
}
|
|
29469
|
+
try {
|
|
29470
|
+
await this.db.exec(`
|
|
29471
|
+
CREATE TABLE IF NOT EXISTS test_runs (
|
|
29472
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
29473
|
+
run_date TEXT
|
|
29474
|
+
);
|
|
29475
|
+
|
|
29476
|
+
CREATE TABLE IF NOT EXISTS test_results (
|
|
29477
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
29478
|
+
run_id INTEGER,
|
|
29479
|
+
test_id TEXT,
|
|
29480
|
+
status TEXT,
|
|
29481
|
+
duration TEXT,
|
|
29482
|
+
error_message TEXT,
|
|
29483
|
+
FOREIGN KEY (run_id) REFERENCES test_runs (id)
|
|
29484
|
+
);
|
|
29485
|
+
`);
|
|
29486
|
+
} catch (error) {
|
|
29487
|
+
console.error("OrtoniReport: Error creating tables:", error);
|
|
29488
|
+
}
|
|
29489
|
+
}
|
|
29490
|
+
async saveTestRun() {
|
|
29491
|
+
if (!this.db) {
|
|
29492
|
+
console.error("OrtoniReport: Database not initialized");
|
|
29493
|
+
return null;
|
|
29494
|
+
}
|
|
29495
|
+
try {
|
|
29496
|
+
const runDate = formatDateUTC(/* @__PURE__ */ new Date());
|
|
29497
|
+
const { lastID } = await this.db.run(`
|
|
29498
|
+
INSERT INTO test_runs (run_date)
|
|
29499
|
+
VALUES (?)
|
|
29500
|
+
`, [runDate]);
|
|
29501
|
+
return lastID;
|
|
29502
|
+
} catch (error) {
|
|
29503
|
+
console.error("OrtoniReport: Error saving test run:", error);
|
|
29504
|
+
return null;
|
|
29505
|
+
}
|
|
29506
|
+
}
|
|
29507
|
+
async saveTestResults(runId, results) {
|
|
29508
|
+
if (!this.db) {
|
|
29509
|
+
console.error("OrtoniReport: Database not initialized");
|
|
29510
|
+
return;
|
|
29511
|
+
}
|
|
29512
|
+
try {
|
|
29513
|
+
const stmt = await this.db.prepare(`
|
|
29514
|
+
INSERT INTO test_results (run_id, test_id, status, duration, error_message)
|
|
29515
|
+
VALUES (?, ?, ?, ?, ?)
|
|
29516
|
+
`);
|
|
29517
|
+
for (const result of results) {
|
|
29518
|
+
await stmt.run([
|
|
29519
|
+
runId,
|
|
29520
|
+
`${result.filePath}:${result.projectName}:${result.title}`,
|
|
29521
|
+
result.status,
|
|
29522
|
+
result.duration,
|
|
29523
|
+
result.errors.join("\n")
|
|
29524
|
+
]);
|
|
29525
|
+
}
|
|
29526
|
+
await stmt.finalize();
|
|
29527
|
+
} catch (error) {
|
|
29528
|
+
console.error("OrtoniReport: Error saving test results:", error);
|
|
29529
|
+
}
|
|
29530
|
+
}
|
|
29531
|
+
async getTestHistory(testId, limit = 10) {
|
|
29532
|
+
if (!this.db) {
|
|
29533
|
+
console.error("OrtoniReport: Database not initialized");
|
|
29534
|
+
return [];
|
|
29535
|
+
}
|
|
29536
|
+
try {
|
|
29537
|
+
const results = await this.db.all(`
|
|
29538
|
+
SELECT tr.status, tr.duration, tr.error_message, trun.run_date
|
|
29539
|
+
FROM test_results tr
|
|
29540
|
+
JOIN test_runs trun ON tr.run_id = trun.id
|
|
29541
|
+
WHERE tr.test_id = ?
|
|
29542
|
+
ORDER BY trun.run_date DESC
|
|
29543
|
+
LIMIT ?
|
|
29544
|
+
`, [testId, limit]);
|
|
29545
|
+
return results.map((result) => ({
|
|
29546
|
+
...result,
|
|
29547
|
+
run_date: formatDateLocal(result.run_date)
|
|
29548
|
+
}));
|
|
29549
|
+
} catch (error) {
|
|
29550
|
+
console.error("OrtoniReport: Error getting test history:", error);
|
|
29551
|
+
return [];
|
|
29552
|
+
}
|
|
29553
|
+
}
|
|
29554
|
+
async close() {
|
|
29555
|
+
if (this.db) {
|
|
29556
|
+
try {
|
|
29557
|
+
await this.db.close();
|
|
29558
|
+
} catch (error) {
|
|
29559
|
+
console.error("OrtoniReport: Error closing database:", error);
|
|
29560
|
+
} finally {
|
|
29561
|
+
this.db = null;
|
|
29562
|
+
}
|
|
29563
|
+
}
|
|
29564
|
+
}
|
|
29565
|
+
};
|
|
29566
|
+
|
|
29408
29567
|
// src/ortoni-report.ts
|
|
29568
|
+
import path7 from "path";
|
|
29409
29569
|
var OrtoniReport = class {
|
|
29410
29570
|
constructor(ortoniConfig = {}) {
|
|
29411
29571
|
this.ortoniConfig = ortoniConfig;
|
|
29412
|
-
// private wsHelper: WebSocketHelper;
|
|
29413
29572
|
this.results = [];
|
|
29414
29573
|
this.projectSet = /* @__PURE__ */ new Set();
|
|
29574
|
+
this.shouldGenerateReport = true;
|
|
29575
|
+
this.showConsoleLogs = true;
|
|
29576
|
+
this.reportsCount = 0;
|
|
29415
29577
|
this.folderPath = ortoniConfig.folderPath || "ortoni-report";
|
|
29416
29578
|
this.outputFilename = ensureHtmlExtension(ortoniConfig.filename || "ortoni-report.html");
|
|
29417
|
-
this.
|
|
29579
|
+
this.dbManager = new DatabaseManager();
|
|
29580
|
+
this.htmlGenerator = new HTMLGenerator(ortoniConfig, this.dbManager);
|
|
29418
29581
|
this.fileManager = new FileManager(this.folderPath);
|
|
29419
29582
|
this.serverManager = new ServerManager(ortoniConfig);
|
|
29420
29583
|
this.testResultProcessor = new TestResultProcessor("");
|
|
29584
|
+
this.showConsoleLogs = ortoniConfig.stdIO !== false;
|
|
29421
29585
|
}
|
|
29422
|
-
onBegin(config, _suite) {
|
|
29586
|
+
async onBegin(config, _suite) {
|
|
29587
|
+
this.reportsCount = config.reporter.length;
|
|
29423
29588
|
this.results = [];
|
|
29424
29589
|
this.testResultProcessor = new TestResultProcessor(config.rootDir);
|
|
29425
29590
|
this.fileManager.ensureReportDirectory();
|
|
29591
|
+
await this.dbManager.initialize(path7.join(this.folderPath, "ortoni-data-history.sqlite"));
|
|
29426
29592
|
}
|
|
29427
|
-
|
|
29593
|
+
onStdOut(chunk, _test, _result) {
|
|
29594
|
+
if (this.reportsCount == 1 && this.showConsoleLogs) {
|
|
29595
|
+
console.log(chunk.toString().trim());
|
|
29596
|
+
}
|
|
29428
29597
|
}
|
|
29429
29598
|
onTestEnd(test, result) {
|
|
29430
29599
|
try {
|
|
@@ -29434,28 +29603,47 @@ var OrtoniReport = class {
|
|
|
29434
29603
|
console.error("OrtoniReport: Error processing test end:", error);
|
|
29435
29604
|
}
|
|
29436
29605
|
}
|
|
29437
|
-
|
|
29606
|
+
printsToStdio() {
|
|
29607
|
+
return true;
|
|
29608
|
+
}
|
|
29609
|
+
onError(error) {
|
|
29610
|
+
if (error.location === void 0) {
|
|
29611
|
+
this.shouldGenerateReport = false;
|
|
29612
|
+
}
|
|
29613
|
+
}
|
|
29614
|
+
async onEnd(result) {
|
|
29438
29615
|
try {
|
|
29439
29616
|
this.overAllStatus = result.status;
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
|
|
29443
|
-
|
|
29444
|
-
|
|
29617
|
+
if (this.shouldGenerateReport) {
|
|
29618
|
+
const filteredResults = this.results.filter((r) => r.status !== "skipped" && !r.isRetry);
|
|
29619
|
+
const totalDuration = msToTime(result.duration);
|
|
29620
|
+
const cssContent = this.fileManager.readCssContent();
|
|
29621
|
+
const runId = await this.dbManager.saveTestRun();
|
|
29622
|
+
if (runId !== null) {
|
|
29623
|
+
await this.dbManager.saveTestResults(runId, this.results);
|
|
29624
|
+
const html = await this.htmlGenerator.generateHTML(filteredResults, totalDuration, cssContent, this.results, this.projectSet);
|
|
29625
|
+
this.outputPath = this.fileManager.writeReportFile(this.outputFilename, html);
|
|
29626
|
+
} else {
|
|
29627
|
+
console.error("OrtoniReport: Error saving test run to database");
|
|
29628
|
+
}
|
|
29629
|
+
} else {
|
|
29630
|
+
console.error("OrtoniReport: Report generation skipped due to error in Playwright worker!");
|
|
29631
|
+
}
|
|
29445
29632
|
} catch (error) {
|
|
29446
|
-
this.
|
|
29633
|
+
this.shouldGenerateReport = false;
|
|
29447
29634
|
console.error("OrtoniReport: Error generating report:", error);
|
|
29448
29635
|
}
|
|
29449
29636
|
}
|
|
29450
29637
|
async onExit() {
|
|
29451
29638
|
try {
|
|
29452
|
-
this.
|
|
29453
|
-
if (this.
|
|
29454
|
-
|
|
29639
|
+
await this.dbManager.close();
|
|
29640
|
+
if (this.shouldGenerateReport) {
|
|
29641
|
+
this.fileManager.copyTraceViewerAssets();
|
|
29642
|
+
console.info(`Ortoni HTML report generated at ${this.outputPath}`);
|
|
29643
|
+
this.serverManager.startServer(this.folderPath, this.outputFilename, this.overAllStatus);
|
|
29644
|
+
await new Promise((_resolve) => {
|
|
29645
|
+
});
|
|
29455
29646
|
}
|
|
29456
|
-
this.serverManager.startServer(this.folderPath, this.outputFilename, this.overAllStatus);
|
|
29457
|
-
await new Promise((_resolve) => {
|
|
29458
|
-
});
|
|
29459
29647
|
} catch (error) {
|
|
29460
29648
|
console.error("OrtoniReport: Error in onExit:", error);
|
|
29461
29649
|
}
|