diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..cf0c46b9 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npx --no-install lint-staged diff --git a/package.json b/package.json index 4929cc14..a76f6eb9 100644 --- a/package.json +++ b/package.json @@ -34,16 +34,16 @@ "homepage": "https://github.com/siimon/prom-client", "devDependencies": { "@clevernature/benchmark-regression": "^1.0.0", - "eslint": "^7.7.0", - "eslint-config-prettier": "^6.10.0", + "eslint": "^8.32.0", + "eslint-config-prettier": "^8.6.0", "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.0.1", + "eslint-plugin-prettier": "^4.2.1", "express": "^4.13.3", - "husky": "^4.2.1", - "jest": "^26.0.1", - "lint-staged": "^10.0.4", + "husky": "^8.0.3", + "jest": "^29.3.1", + "lint-staged": "^13.1.0", "nock": "^13.0.5", - "prettier": "2.7.1", + "prettier": "2.8.3", "typescript": "^4.0.2" }, "dependencies": { @@ -79,10 +79,5 @@ } } ] - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } } } diff --git a/test/__snapshots__/registerTest.js.snap b/test/__snapshots__/registerTest.js.snap index 320e5fb7..47548530 100644 --- a/test/__snapshots__/registerTest.js.snap +++ b/test/__snapshots__/registerTest.js.snap @@ -26,30 +26,30 @@ gauge 0 # HELP histogram help # TYPE histogram histogram -histogram_bucket{le=\\"0.005\\"} 0 -histogram_bucket{le=\\"0.01\\"} 0 -histogram_bucket{le=\\"0.025\\"} 0 -histogram_bucket{le=\\"0.05\\"} 0 -histogram_bucket{le=\\"0.1\\"} 0 -histogram_bucket{le=\\"0.25\\"} 0 -histogram_bucket{le=\\"0.5\\"} 0 -histogram_bucket{le=\\"1\\"} 0 -histogram_bucket{le=\\"2.5\\"} 0 -histogram_bucket{le=\\"5\\"} 0 -histogram_bucket{le=\\"10\\"} 0 -histogram_bucket{le=\\"+Inf\\"} 0 +histogram_bucket{le="0.005"} 0 +histogram_bucket{le="0.01"} 0 +histogram_bucket{le="0.025"} 0 +histogram_bucket{le="0.05"} 0 +histogram_bucket{le="0.1"} 0 +histogram_bucket{le="0.25"} 0 +histogram_bucket{le="0.5"} 0 +histogram_bucket{le="1"} 0 +histogram_bucket{le="2.5"} 0 +histogram_bucket{le="5"} 0 +histogram_bucket{le="10"} 0 +histogram_bucket{le="+Inf"} 0 histogram_sum 0 histogram_count 0 # HELP summary help # TYPE summary summary -summary{quantile=\\"0.01\\"} 0 -summary{quantile=\\"0.05\\"} 0 -summary{quantile=\\"0.5\\"} 0 -summary{quantile=\\"0.9\\"} 0 -summary{quantile=\\"0.95\\"} 0 -summary{quantile=\\"0.99\\"} 0 -summary{quantile=\\"0.999\\"} 0 +summary{quantile="0.01"} 0 +summary{quantile="0.05"} 0 +summary{quantile="0.5"} 0 +summary{quantile="0.9"} 0 +summary{quantile="0.95"} 0 +summary{quantile="0.99"} 0 +summary{quantile="0.999"} 0 summary_sum 0 summary_count 0 " diff --git a/test/__snapshots__/summaryTest.js.snap b/test/__snapshots__/summaryTest.js.snap index f9f18ce0..45bea2e8 100644 --- a/test/__snapshots__/summaryTest.js.snap +++ b/test/__snapshots__/summaryTest.js.snap @@ -4,4 +4,4 @@ exports[`summary global registry with param as object labels should throw error exports[`summary global registry with param as object remove should throw error if label lengths does not match 1`] = `"Invalid number of arguments"`; -exports[`summary global registry with param as object should validate labels when observing 1`] = `"Added label \\"baz\\" is not included in initial labelset: [ 'foo' ]"`; +exports[`summary global registry with param as object should validate labels when observing 1`] = `"Added label "baz" is not included in initial labelset: [ 'foo' ]"`; diff --git a/test/metrics/eventLoopLagTest.js b/test/metrics/eventLoopLagTest.js index ae20e570..8662c299 100644 --- a/test/metrics/eventLoopLagTest.js +++ b/test/metrics/eventLoopLagTest.js @@ -12,7 +12,7 @@ describe('eventLoopLag', () => { register.clear(); }); - it('should add metric to the registry', async done => { + it('should add metric to the registry', async () => { expect(await register.getMetricsAsJSON()).toHaveLength(0); eventLoopLag(); @@ -62,8 +62,6 @@ describe('eventLoopLag', () => { ); expect(metrics[7].type).toEqual('gauge'); expect(metrics[7].name).toEqual('nodejs_eventloop_lag_p99_seconds'); - - done(); }); });