From 47d71656ec7a064436a83c0455cdee0bb5acb8e0 Mon Sep 17 00:00:00 2001
From: Matteo Collina <hello@matteocollina.com>
Date: Mon, 29 Apr 2024 15:54:15 +0200
Subject: [PATCH 1/3] Drop old nodes

Signed-off-by: Matteo Collina <hello@matteocollina.com>
---
 .github/workflows/node.js.yml |  9 ---------
 .gitignore                    |  2 ++
 .taprc                        |  3 ---
 package.json                  |  8 ++++----
 test/find-route.test.js       | 14 +++++++-------
 test/issue-330.test.js        | 10 +++++-----
 6 files changed, 18 insertions(+), 28 deletions(-)
 delete mode 100644 .taprc

diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 33560040..67684ef1 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -18,23 +18,14 @@ jobs:
     strategy:
       matrix:
         node-version:
-          - 14
-          - 16
           - 18
           - 20
-          - 21
           - 22
         os: 
           - ubuntu-latest
           - windows-latest
           - macOS-latest
         exclude:
-          - os: windows-latest
-            node-version: 14
-          - os: macos-latest
-            node-version: 14
-          - os: macos-latest
-            node-version: 16
           - os: windows-latest
             node-version: 22 
 
diff --git a/.gitignore b/.gitignore
index 06d57874..ef93bcf2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,3 +43,5 @@ jspm_packages
 *.swp
 
 package-lock.json
+
+.tap
diff --git a/.taprc b/.taprc
deleted file mode 100644
index 3cde38bf..00000000
--- a/.taprc
+++ /dev/null
@@ -1,3 +0,0 @@
-ts: false
-jsx: false
-flow: false
diff --git a/package.json b/package.json
index b266a60f..d2103877 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
     "bench:cmp:ci": "node ./benchmark/compare-branches.js --ci",
     "test:lint": "standard",
     "test:typescript": "tsd",
-    "test": "standard && tap -J test/*.test.js && npm run test:typescript",
+    "test": "standard && tap --allow-incomplete-coverage test/*.test.js && npm run test:typescript",
     "test:report": "tap -J test/*.test.js --cov --coverage-report=html --coverage-report=cobertura | tee out.tap",
     "test:reporter": "tap-mocha-reporter xunit < out.tap > test/junit-testresults.xml"
   },
@@ -35,7 +35,7 @@
   },
   "homepage": "https://github.com/delvedor/find-my-way#readme",
   "devDependencies": {
-    "@types/node": "^14.0.27",
+    "@types/node": "^20.0.0",
     "benchmark": "^2.1.4",
     "chalk": "^4.1.2",
     "inquirer": "^8.2.4",
@@ -43,8 +43,8 @@
     "proxyquire": "^2.1.3",
     "rfdc": "^1.3.0",
     "simple-git": "^3.7.1",
-    "standard": "^14.3.4",
-    "tap": "^16.0.1",
+    "standard": "^17.0.0",
+    "tap": "^18.0.0",
     "tap-mocha-reporter": "^5.0.1",
     "tsd": "^0.13.1"
   },
diff --git a/test/find-route.test.js b/test/find-route.test.js
index a0c6f1b4..9b34e722 100644
--- a/test/find-route.test.js
+++ b/test/find-route.test.js
@@ -47,7 +47,7 @@ test('findRoute returns handler and store for a static route', (t) => {
   const route = findMyWay.findRoute('GET', '/example')
   t.equal(route.handler, handler)
   t.equal(route.store, store)
-  t.deepEqual(route.params, [])
+  t.same(route.params, [])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
@@ -80,7 +80,7 @@ test('findRoute returns handler and params for a parametric route', (t) => {
 
   const route = findMyWay.findRoute('GET', '/:param')
   t.equal(route.handler, handler)
-  t.deepEqual(route.params, ['param'])
+  t.same(route.params, ['param'])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
@@ -113,7 +113,7 @@ test('findRoute returns handler and params for a parametric route with static su
 
   const route = findMyWay.findRoute('GET', '/:param-static')
   t.equal(route.handler, handler)
-  t.deepEqual(route.params, ['param'])
+  t.same(route.params, ['param'])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
@@ -144,7 +144,7 @@ test('findRoute returns handler and original params even if a param name differe
 
   const route = findMyWay.findRoute('GET', '/:param2')
   t.equal(route.handler, handler)
-  t.deepEqual(route.params, ['param1'])
+  t.same(route.params, ['param1'])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
@@ -161,7 +161,7 @@ test('findRoute returns handler and params for a multi-parametric route', (t) =>
 
   const route = findMyWay.findRoute('GET', '/:param1-:param2')
   t.equal(route.handler, handler)
-  t.deepEqual(route.params, ['param1', 'param2'])
+  t.same(route.params, ['param1', 'param2'])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
@@ -192,7 +192,7 @@ test('findRoute returns handler and regexp param for a regexp route', (t) => {
 
   const route = findMyWay.findRoute('GET', '/:param(^\\d+$)')
   t.equal(route.handler, handler)
-  t.deepEqual(route.params, ['param'])
+  t.same(route.params, ['param'])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
@@ -223,7 +223,7 @@ test('findRoute returns handler and wildcard param for a wildcard route', (t) =>
 
   const route = findMyWay.findRoute('GET', '/example/*')
   t.equal(route.handler, handler)
-  t.deepEqual(route.params, ['*'])
+  t.same(route.params, ['*'])
 
   equalRouters(t, findMyWay, fundMyWayClone)
 })
diff --git a/test/issue-330.test.js b/test/issue-330.test.js
index 452511b8..14906e13 100644
--- a/test/issue-330.test.js
+++ b/test/issue-330.test.js
@@ -149,7 +149,7 @@ test('Cannot derive constraints without active strategies.', (t) => {
   const constrainer = new Constrainer()
   const before = constrainer.deriveSyncConstraints
   constrainer._buildDeriveConstraints()
-  t.sameStrict(constrainer.deriveSyncConstraints, before)
+  t.same(constrainer.deriveSyncConstraints, before)
 })
 
 test('getMatchingHandler should return null if not compiled', (t) => {
@@ -195,13 +195,13 @@ test('SemVerStore.maxPatches should increase automatically', (t) => {
   const storage = new Storage()
 
   storage.set('2.0.0')
-  t.sameStrict(storage.maxPatches, { '2.0': 0 })
+  t.same(storage.maxPatches, { '2.0': 0 })
 
   storage.set('2.0.2')
-  t.sameStrict(storage.maxPatches, { '2.0': 2 })
+  t.same(storage.maxPatches, { '2.0': 2 })
 
   storage.set('2.0.1')
-  t.sameStrict(storage.maxPatches, { '2.0': 2 })
+  t.same(storage.maxPatches, { '2.0': 2 })
 })
 
 test('Major version must be a numeric value', t => {
@@ -228,5 +228,5 @@ test('if buildPrettyMeta argument is undefined, will return an object', (t) => {
   t.plan(1)
 
   const findMyWay = FindMyWay()
-  t.sameStrict(findMyWay.buildPrettyMeta(), {})
+  t.same(findMyWay.buildPrettyMeta(), {})
 })

From 6e73d4e24a9893d9b674d1709bc3ba2d6bb9ec68 Mon Sep 17 00:00:00 2001
From: Matteo Collina <hello@matteocollina.com>
Date: Mon, 2 Sep 2024 10:26:46 +0200
Subject: [PATCH 2/3] fixup

Signed-off-by: Matteo Collina <hello@matteocollina.com>
---
 .github/workflows/node.js.yml | 1 -
 package.json                  | 4 ++--
 test/null-object.test.js      | 2 +-
 test/types/router.test-d.ts   | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 67684ef1..b2181531 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -18,7 +18,6 @@ jobs:
     strategy:
       matrix:
         node-version:
-          - 18
           - 20
           - 22
         os: 
diff --git a/package.json b/package.json
index 6d7b8da3..6ab5e987 100644
--- a/package.json
+++ b/package.json
@@ -46,12 +46,12 @@
     "standard": "^17.0.0",
     "tap": "^18.0.0",
     "tap-mocha-reporter": "^5.0.1",
-    "tsd": "^0.13.1"
+    "tsd": "^0.31.0"
   },
   "dependencies": {
     "fast-deep-equal": "^3.1.3",
     "fast-querystring": "^1.0.0",
-    "safe-regex2": "^3.1.0"
+    "safe-regex2": "^4.0.0"
   },
   "tsd": {
     "directory": "test/types"
diff --git a/test/null-object.test.js b/test/null-object.test.js
index 57a94710..b6d6921f 100644
--- a/test/null-object.test.js
+++ b/test/null-object.test.js
@@ -12,7 +12,7 @@ test('NullObject', t => {
 
 test('has no methods from generic Object class', t => {
   function getAllPropertyNames (obj) {
-    var props = []
+    const props = []
 
     do {
       Object.getOwnPropertyNames(obj).forEach(function (prop) {
diff --git a/test/types/router.test-d.ts b/test/types/router.test-d.ts
index ae8430e6..a0477f83 100644
--- a/test/types/router.test-d.ts
+++ b/test/types/router.test-d.ts
@@ -1,5 +1,5 @@
 import { expectType } from 'tsd'
-import * as Router from '../../'
+import Router from '../../'
 import { Http2ServerRequest, Http2ServerResponse } from 'http2'
 import { IncomingMessage, ServerResponse } from 'http'
 

From 6c633f34e56e9d59b905ae6ce104af8ecb7fd5e6 Mon Sep 17 00:00:00 2001
From: Matteo Collina <hello@matteocollina.com>
Date: Mon, 2 Sep 2024 10:28:59 +0200
Subject: [PATCH 3/3] updated tap

Signed-off-by: Matteo Collina <hello@matteocollina.com>
---
 lib/strategies/http-method.js | 3 ++-
 package.json                  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/strategies/http-method.js b/lib/strategies/http-method.js
index 00e6a6b8..d409fffe 100644
--- a/lib/strategies/http-method.js
+++ b/lib/strategies/http-method.js
@@ -9,6 +9,7 @@ module.exports = {
       set: (type, store) => { handlers[type] = store }
     }
   },
-  deriveConstraint: /* istanbul ignore next */ (req) => req.method,
+  /* c8 ignore next 1 */
+  deriveConstraint: (req) => req.method,
   mustMatchWhenDerived: true
 }
diff --git a/package.json b/package.json
index 6ab5e987..973e792e 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
     "rfdc": "^1.3.0",
     "simple-git": "^3.7.1",
     "standard": "^17.0.0",
-    "tap": "^18.0.0",
+    "tap": "^21.0.1",
     "tap-mocha-reporter": "^5.0.1",
     "tsd": "^0.31.0"
   },