From 697c99175e38d9c3cf118b6fb0c7a7ff7e648fa4 Mon Sep 17 00:00:00 2001 From: Cristian Barlutiu Date: Tue, 26 Mar 2024 12:44:40 +0100 Subject: [PATCH] Update for Fastify v5 (#332) * Update for Fastify v5 * remove --cov arg, enabled by default * update @fastify/pre-commit to latest * enable coverage * ignored coverage error --- .github/workflows/ci.yml | 2 +- jwt.js | 5 ++--- package.json | 18 +++++++++--------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b00276..5395d92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ on: jobs: test: - uses: fastify/workflows/.github/workflows/plugins-ci.yml@v3 + uses: fastify/workflows/.github/workflows/plugins-ci.yml@v4.1.0 with: license-check: true lint: true diff --git a/jwt.js b/jwt.js index 4e8779e..f541dd1 100644 --- a/jwt.js +++ b/jwt.js @@ -216,14 +216,13 @@ function fastifyJwt (fastify, options, next) { } catch (error) { // Ignoring the else branch because it's not possible to test it, // it's just a safeguard for future changes in the fast-jwt library - /* istanbul ignore next */ if (error.code === TokenError.codes.malformed) { throw new AuthorizationTokenInvalidError(error.message) } else if (error.code === TokenError.codes.invalidType) { throw new AuthorizationTokenInvalidError(error.message) - } else { + } /* c8 ignore start */ else { throw error - } + } /* c8 ignore stop */ } } diff --git a/package.json b/package.json index 8f848a8..3461d1e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "test": "npm run lint && npm run test:unit && npm run test:typescript", "test:typescript": "tsd", "test:unit": "tap", - "test:unit:report": "tap --cov --coverage-report=html", + "test:unit:report": "tap --coverage-report=html", "test:unit:verbose": "tap -Rspec" }, "repository": { @@ -33,18 +33,18 @@ "homepage": "https://github.com/fastify/fastify-jwt#readme", "dependencies": { "@fastify/error": "^4.0.0", - "@lukeed/ms": "^2.0.0", + "@lukeed/ms": "^2.0.2", "fast-jwt": "^4.0.0", - "fastify-plugin": "^4.0.0", + "fastify-plugin": "^4.5.1", "steed": "^1.1.3" }, "devDependencies": { - "@fastify/cookie": "^9.0.4", - "@fastify/pre-commit": "^2.0.2", - "@types/node": "^20.1.1", - "fastify": "^4.0.0-rc.2", - "standard": "^17.0.0", - "tap": "^16.0.0", + "@fastify/cookie": "^9.3.1", + "@fastify/pre-commit": "^2.1.0", + "@types/node": "^20.11.29", + "fastify": "^4.26.2", + "standard": "^17.1.0", + "tap": "^18.7.1", "tsd": "^0.31.0" }, "publishConfig": {