@contrast/route-coverage 1.31.0 → 1.32.0
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 +1 -1
- package/lib/install/express.test.js +1 -1
- package/lib/install/fastify.js +1 -1
- package/lib/install/fastify.test.js +1 -1
- package/lib/install/http.js +2 -2
- package/lib/install/koa.js +1 -1
- package/lib/install/koa.test.js +1 -1
- package/lib/install/restify.js +1 -1
- package/lib/install/restify.test.js +1 -1
- package/package.json +7 -7
package/lib/install/express.js
CHANGED
|
@@ -115,7 +115,7 @@ module.exports = function init(core) {
|
|
|
115
115
|
}
|
|
116
116
|
return core.routeCoverage.express = {
|
|
117
117
|
install() {
|
|
118
|
-
depHooks.resolve({ name: 'express', version: '>=4
|
|
118
|
+
depHooks.resolve({ name: 'express', version: '>=4 <5' }, (express) => {
|
|
119
119
|
patcher.patch(express.application, 'use', {
|
|
120
120
|
name: 'express.application.use',
|
|
121
121
|
patchType,
|
|
@@ -83,7 +83,7 @@ describe('route-coverage express', function () {
|
|
|
83
83
|
|
|
84
84
|
fn = sinon.stub();
|
|
85
85
|
|
|
86
|
-
core.depHooks.resolve.withArgs({ name: 'express', version: '>=4
|
|
86
|
+
core.depHooks.resolve.withArgs({ name: 'express', version: '>=4 <5' }).yields(express);
|
|
87
87
|
core.depHooks.resolve.withArgs({ name: 'http' }).yields(http);
|
|
88
88
|
|
|
89
89
|
require('./express')(core).install();
|
package/lib/install/fastify.js
CHANGED
|
@@ -110,7 +110,7 @@ module.exports = function init(core) {
|
|
|
110
110
|
[
|
|
111
111
|
{ version: '>=3 <4.1.0', routeObj: false },
|
|
112
112
|
{ version: '>=4.1.0 <4.4.0', routeObj: true },
|
|
113
|
-
{ version: '>=4.4.0', routeObj: true }
|
|
113
|
+
{ version: '>=4.4.0 <5', routeObj: true }
|
|
114
114
|
].forEach(({ version, routeObj }) => {
|
|
115
115
|
// See ../utils/methods
|
|
116
116
|
// Using .all shorthand uses all valid methods but those change after version 4.4.0
|
|
@@ -10,7 +10,7 @@ const { getFastifyMethods } = require('../utils/methods');
|
|
|
10
10
|
[
|
|
11
11
|
{ version: '>=3 <4.1.0', routeObj: false },
|
|
12
12
|
{ version: '>=4.1.0 <4.4.0', routeObj: true },
|
|
13
|
-
{ version: '>=4.4.0', routeObj: true }
|
|
13
|
+
{ version: '>=4.4.0 <5', routeObj: true }
|
|
14
14
|
].forEach(({ version, routeObj }) => {
|
|
15
15
|
describe(`route-coverage fastify (${version})`, function () {
|
|
16
16
|
const FASTIFY_METHODS = getFastifyMethods(version);
|
package/lib/install/http.js
CHANGED
|
@@ -21,8 +21,8 @@ module.exports = function init(core) {
|
|
|
21
21
|
|
|
22
22
|
return core.routeCoverage.http = {
|
|
23
23
|
install() {
|
|
24
|
-
['http', 'https', 'spdy'].forEach((name) => {
|
|
25
|
-
depHooks.resolve({ name }, (_export) => {
|
|
24
|
+
[['http', '*'], ['https', '*'], ['spdy', '<5']].forEach(([name, version]) => {
|
|
25
|
+
depHooks.resolve({ name, version }, (_export) => {
|
|
26
26
|
if (!_export?.Server?.prototype) return;
|
|
27
27
|
|
|
28
28
|
patcher.patch(_export.Server.prototype, 'listen', {
|
package/lib/install/koa.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = function init(core) {
|
|
|
36
36
|
|
|
37
37
|
return core.routeCoverage.koa = {
|
|
38
38
|
install() {
|
|
39
|
-
depHooks.resolve({ name: 'koa', version: '>=2.3.0' }, (Koa) => {
|
|
39
|
+
depHooks.resolve({ name: 'koa', version: '>=2.3.0 <3' }, (Koa) => {
|
|
40
40
|
// Koa uses its own routing library @koa/router to define routes before
|
|
41
41
|
// mounting them on the app with .use so instrumenting use and traversing
|
|
42
42
|
// the constructed routes is the more technically correct approach than
|
package/lib/install/koa.test.js
CHANGED
|
@@ -32,7 +32,7 @@ describe('route-coverage koa', function () {
|
|
|
32
32
|
|
|
33
33
|
Koa = function() {};
|
|
34
34
|
Koa.prototype.use = sinon.stub();
|
|
35
|
-
core.depHooks.resolve.withArgs({ name: 'koa', version: '>=2.3.0' }).yields(Koa);
|
|
35
|
+
core.depHooks.resolve.withArgs({ name: 'koa', version: '>=2.3.0 <3' }).yields(Koa);
|
|
36
36
|
require('./koa')(core).install();
|
|
37
37
|
});
|
|
38
38
|
|
package/lib/install/restify.js
CHANGED
|
@@ -36,7 +36,7 @@ module.exports = function init(core) {
|
|
|
36
36
|
|
|
37
37
|
return core.routeCoverage.restify = {
|
|
38
38
|
install() {
|
|
39
|
-
depHooks.resolve({ name: 'restify', version: '>=
|
|
39
|
+
depHooks.resolve({ name: 'restify', version: '>=8 <12' }, (restify) => {
|
|
40
40
|
patcher.patch(restify, 'createServer', {
|
|
41
41
|
name: 'restify.createServer',
|
|
42
42
|
patchType,
|
|
@@ -38,7 +38,7 @@ describe('route-coverage restify', function () {
|
|
|
38
38
|
restify = {
|
|
39
39
|
createServer: () => serverMock
|
|
40
40
|
};
|
|
41
|
-
core.depHooks.resolve.withArgs({ name: 'restify', version: '>=
|
|
41
|
+
core.depHooks.resolve.withArgs({ name: 'restify', version: '>=8 <12' }).yields(restify);
|
|
42
42
|
require('./restify')(core).install();
|
|
43
43
|
});
|
|
44
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/route-coverage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
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,13 +17,13 @@
|
|
|
17
17
|
"test": "../scripts/test.sh"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@contrast/common": "1.
|
|
21
|
-
"@contrast/config": "1.
|
|
22
|
-
"@contrast/dep-hooks": "1.
|
|
20
|
+
"@contrast/common": "1.27.0",
|
|
21
|
+
"@contrast/config": "1.37.0",
|
|
22
|
+
"@contrast/dep-hooks": "1.11.0",
|
|
23
23
|
"@contrast/fn-inspect": "^4.3.0",
|
|
24
|
-
"@contrast/logger": "1.
|
|
25
|
-
"@contrast/patcher": "1.
|
|
26
|
-
"@contrast/scopes": "1.
|
|
24
|
+
"@contrast/logger": "1.15.0",
|
|
25
|
+
"@contrast/patcher": "1.14.0",
|
|
26
|
+
"@contrast/scopes": "1.12.0",
|
|
27
27
|
"semver": "^7.6.0"
|
|
28
28
|
}
|
|
29
29
|
}
|