@contrast/route-coverage 1.20.5 → 1.20.6

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.
@@ -54,7 +54,8 @@ module.exports = function init(core) {
54
54
  signature: createSignature(url, method, obj),
55
55
  url,
56
56
  normalizedUrl: url,
57
- method
57
+ method,
58
+ framework: 'express'
58
59
  };
59
60
  }
60
61
 
@@ -74,7 +75,7 @@ module.exports = function init(core) {
74
75
  });
75
76
  }
76
77
 
77
- function traverse(path = '', stack, depth = 0) {
78
+ function traverse(stack, path = '', depth = 0) {
78
79
  path = format(path);
79
80
  stack.forEach((layer) => {
80
81
  if (isRoute(layer)) {
@@ -84,7 +85,7 @@ module.exports = function init(core) {
84
85
  patchHandle(layer, routeInfo);
85
86
  } else if (isRouter(layer)) {
86
87
  const regexPath = regExpToPath(layer.regexp);
87
- if (depth < 3) traverse(path + regexPath, layer.handle.stack, depth += 1);
88
+ if (depth < 3) traverse(layer.handle.stack, path + regexPath, depth += 1);
88
89
  } else {
89
90
  const regexPath = regExpToPath(layer.regexp);
90
91
  const routeInfo = createRouteInfo(path + regexPath, 'use');
@@ -107,7 +108,7 @@ module.exports = function init(core) {
107
108
  const handlers = Array.isArray(fn) ? fn : [fn];
108
109
  handlers.forEach((layer) => {
109
110
  if (isRouter(layer)) {
110
- traverse(path, layer.stack);
111
+ traverse(layer.stack, path);
111
112
  } else if (path) {
112
113
  const routeInfo = createRouteInfo(format(path), 'use', 'App');
113
114
  discover(routeInfo);
@@ -70,7 +70,7 @@ module.exports = function init(core) {
70
70
  */
71
71
  function emitRouteCoverage(url, method) {
72
72
  method = StringPrototypeToLowerCase.call(method);
73
- const event = { signature: createSignature(url, method), url, method, normalizedUrl: url };
73
+ const event = { signature: createSignature(url, method), url, method, normalizedUrl: url, framework: 'fastify' };
74
74
  routeCoverage.discover(event);
75
75
  }
76
76
 
@@ -22,7 +22,7 @@ module.exports = function init(core) {
22
22
 
23
23
  function emitRouteCoverage(url, method) {
24
24
  method = StringPrototypeToLowerCase.call(method);
25
- const event = { signature: createSignature(url, method), url, method, normalizedUrl: url };
25
+ const event = { signature: createSignature(url, method), url, method, normalizedUrl: url, framework: 'hapi' };
26
26
  routeCoverage.discover(event);
27
27
  }
28
28
 
@@ -21,7 +21,7 @@ module.exports = function init(core) {
21
21
  const { patcher, depHooks, routeCoverage } = core;
22
22
 
23
23
  function emitRouteCoverage(url, method) {
24
- const event = { signature: createSignature(url, method), url, method, normalizedUrl: url };
24
+ const event = { signature: createSignature(url, method), url, method, normalizedUrl: url, framework: 'koa' };
25
25
  routeCoverage.discover(event);
26
26
  }
27
27
 
@@ -28,7 +28,8 @@ module.exports = function init(core) {
28
28
  signature: createSignature(url, method, 'Server'),
29
29
  method,
30
30
  url,
31
- normalizedUrl: url
31
+ normalizedUrl: url,
32
+ framework: 'restify'
32
33
  };
33
34
  }
34
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/route-coverage",
3
- "version": "1.20.5",
3
+ "version": "1.20.6",
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)",
@@ -17,7 +17,7 @@
17
17
  "test": "../scripts/test.sh"
18
18
  },
19
19
  "dependencies": {
20
- "@contrast/common": "1.21.1",
20
+ "@contrast/common": "1.21.2",
21
21
  "@contrast/fn-inspect": "^4.0.0"
22
22
  }
23
23
  }