@contrast/route-coverage 1.20.2 → 1.20.4
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/lib/install/express.js +4 -4
- package/package.json +1 -1
package/lib/install/express.js
CHANGED
|
@@ -74,7 +74,7 @@ module.exports = function init(core) {
|
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function traverse(path, stack, depth = 0) {
|
|
77
|
+
function traverse(path = '', stack, depth = 0) {
|
|
78
78
|
path = format(path);
|
|
79
79
|
stack.forEach((layer) => {
|
|
80
80
|
if (isRoute(layer)) {
|
|
@@ -102,13 +102,13 @@ module.exports = function init(core) {
|
|
|
102
102
|
post({ args, result }) {
|
|
103
103
|
const len = args.length;
|
|
104
104
|
const fn = args[len - 1];
|
|
105
|
-
const path = len > 1 ? args[0] :
|
|
106
|
-
if (!isValidPath(path)) return;
|
|
105
|
+
const path = len > 1 ? args[0] : undefined;
|
|
106
|
+
if (path && !isValidPath(path)) return;
|
|
107
107
|
const handlers = Array.isArray(fn) ? fn : [fn];
|
|
108
108
|
handlers.forEach((layer) => {
|
|
109
109
|
if (isRouter(layer)) {
|
|
110
110
|
traverse(path, layer.stack);
|
|
111
|
-
} else {
|
|
111
|
+
} else if (path) {
|
|
112
112
|
const routeInfo = createRouteInfo(format(path), 'use', 'App');
|
|
113
113
|
discover(routeInfo);
|
|
114
114
|
const lastLayer = getLastLayer(result._router);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/route-coverage",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.4",
|
|
4
4
|
"description": "Handles route discovery and observation",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|