Skip to content

Commit 351de8e

Browse files
fix: getResponseTime deprecation warning (#383)
* fix: getResponseTime deprecation warning * expose coverage lcov * fix * fix github action
1 parent 616fe94 commit 351de8e

File tree

7 files changed

+24
-19
lines changed

7 files changed

+24
-19
lines changed

.github/workflows/node.js.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ jobs:
3333
- run: npm test
3434

3535
- name: Coveralls
36-
uses: coverallsapp/github-action@master
36+
uses: coverallsapp/github-action@v2
3737
with:
3838
github-token: ${{ secrets.GITHUB_TOKEN }}
39+
file: ./.tap/report/lcov.info
3940

4041
publish:
4142
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ coverage
1919

2020
# nyc test coverage
2121
.nyc_output
22+
.tap
2223

2324
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
2425
.grunt

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- use `reply.elapsedTime` instead of the deprecated `reply.getResponseTime()` to get the elapsed time of the request
12+
913
## v8.0.1 - 2024-08-06
1014

1115
### Fixed

lib/custom-logger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function logRequestCompleted(req, reply, next) {
109109
forwardedHost: headers['x-forwarded-host'],
110110
ip: headers['x-forwarded-for'],
111111
},
112-
responseTime: reply.getResponseTime(),
112+
responseTime: reply.elapsedTime,
113113
}, 'request completed')
114114
next()
115115
}

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
},
3333
"scripts": {
3434
"checkonly": "! grep -R '\\.only' tests/",
35-
"coverage": "npm run unit -- --coverage-report=text-summary",
36-
"postcoverage": "tap --coverage-report=html --no-browser",
35+
"coverage": "npm run unit -- --coverage-report=text-summary --coverage-report=lcov --no-browser",
3736
"lint": "eslint . --ignore-path .gitignore",
3837
"test": "npm run lint && npm run coverage && npm run test:types && npm run checkonly",
3938
"unit": "tap -b -o tap.log tests/*.test.js",
@@ -44,27 +43,27 @@
4443
"@fastify/sensible": "^5.5.0",
4544
"@fastify/swagger": "^8.12.0",
4645
"@fastify/swagger-ui": "^1.10.1",
47-
"@opentelemetry/auto-instrumentations-node": "^0.48.0",
48-
"@opentelemetry/sdk-node": "^0.49.1",
49-
"@opentelemetry/sdk-trace-base": "^1.18.1",
46+
"@opentelemetry/auto-instrumentations-node": "^0.49.1",
47+
"@opentelemetry/sdk-node": "^0.52.1",
48+
"@opentelemetry/sdk-trace-base": "^1.25.1",
5049
"commander": "^11.1.0",
5150
"dotenv": "^16.3.1",
5251
"dotenv-expand": "^11.0.3",
53-
"fastify": "^4.24.3",
52+
"fastify": "^4.28.1",
5453
"fastify-metrics": "^10.3.3",
5554
"fastify-plugin": "^4.5.1",
5655
"lodash.get": "^4.4.2",
5756
"prom-client": "^14.2.0"
5857
},
5958
"devDependencies": {
6059
"@mia-platform/eslint-config-mia": "^3.0.0",
61-
"ajv": "^8.12.0",
60+
"ajv": "^8.17.1",
6261
"eslint": "^8.53.0",
63-
"semver": "^7.5.4",
62+
"semver": "^7.6.3",
6463
"split2": "^4.2.0",
6564
"swagger-parser": "^10.0.3",
66-
"tap": "^16.3.7",
67-
"tsd": "^0.30.4"
65+
"tap": "^21.0.1",
66+
"tsd": "^0.31.1"
6867
},
6968
"engines": {
7069
"node": ">=14"
@@ -73,6 +72,6 @@
7372
"extends": "@mia-platform/eslint-config-mia"
7473
},
7574
"tap": {
76-
"check-coverage": false
75+
"allow-incomplete-coverage": true
7776
}
7877
}

tap-snapshots/tests/custom-logger.test.js.test.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`tests/custom-logger.test.js TAP Test log serialize error both for error and err fields > must match snapshot 1`] = `
8+
exports[`tests/custom-logger.test.js > TAP > Test log serialize error both for error and err fields > must match snapshot 1`] = `
99
Array [
1010
Object {
1111
"err": Object {
@@ -22,7 +22,7 @@ Array [
2222
]
2323
`
2424

25-
exports[`tests/custom-logger.test.js TAP Test redacted values - uppercase headers > must match snapshot 1`] = `
25+
exports[`tests/custom-logger.test.js > TAP > Test redacted values - uppercase headers > must match snapshot 1`] = `
2626
Array [
2727
Object {
2828
"headersToSend": Object {
@@ -33,7 +33,7 @@ Array [
3333
]
3434
`
3535

36-
exports[`tests/custom-logger.test.js TAP Test redacted values > must match snapshot 1`] = `
36+
exports[`tests/custom-logger.test.js > TAP > Test redacted values > must match snapshot 1`] = `
3737
Array [
3838
Object {
3939
"headers": Object {

tap-snapshots/tests/documentation-routes.test.js.test.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`tests/documentation-routes.test.js TAP Test Fastify creation with custom prefix > must match snapshot 1`] = `
8+
exports[`tests/documentation-routes.test.js > TAP > Test Fastify creation with custom prefix > must match snapshot 1`] = `
99
Object {
1010
"components": Object {
1111
"schemas": Object {
@@ -204,7 +204,7 @@ Object {
204204
}
205205
`
206206

207-
exports[`tests/documentation-routes.test.js TAP Test Fastify creation with custom prefix without trailing slash > must match snapshot 1`] = `
207+
exports[`tests/documentation-routes.test.js > TAP > Test Fastify creation with custom prefix without trailing slash > must match snapshot 1`] = `
208208
Object {
209209
"components": Object {
210210
"schemas": Object {
@@ -410,7 +410,7 @@ Object {
410410
}
411411
`
412412

413-
exports[`tests/documentation-routes.test.js TAP Test Fastify creation with no prefix > must match snapshot 1`] = `
413+
exports[`tests/documentation-routes.test.js > TAP > Test Fastify creation with no prefix > must match snapshot 1`] = `
414414
Object {
415415
"components": Object {
416416
"schemas": Object {

0 commit comments

Comments
 (0)