Skip to content

Commit 812f0bf

Browse files
committed
fix: update dependencies
BREAKING CHANGE: this raises the min Node.js version to 22.13.0
1 parent 8c8e964 commit 812f0bf

File tree

7 files changed

+769
-764
lines changed

7 files changed

+769
-764
lines changed

package-lock.json

Lines changed: 711 additions & 706 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
"author": "Nordic Semiconductor ASA | nordicsemi.no",
3333
"license": "BSD-3-Clause",
3434
"devDependencies": {
35-
"@bifravst/eslint-config-typescript": "6.4.2",
35+
"@bifravst/eslint-config-typescript": "6.4.3",
3636
"@bifravst/prettier-config": "1.1.12",
3737
"@commitlint/config-conventional": "19.8.1",
3838
"@types/aws-lambda": "8.10.152",
39-
"@types/node": "22.16.5",
39+
"@types/node": "24.3.0",
4040
"globstar": "1.0.0",
4141
"husky": "9.1.7",
42-
"nock": "^14.0.6",
43-
"tsx": "4.20.3"
42+
"nock": "14.0.10",
43+
"tsx": "4.20.4"
4444
},
4545
"lint-staged": {
4646
"*.ts": [
@@ -52,7 +52,7 @@
5252
]
5353
},
5454
"engines": {
55-
"node": ">=22",
55+
"node": ">=22.13.0",
5656
"npm": ">=10"
5757
},
5858
"release": {
@@ -83,13 +83,12 @@
8383
],
8484
"prettier": "@bifravst/prettier-config",
8585
"peerDependencies": {
86-
"@aws-sdk/client-dynamodb": "^3.848.0",
87-
"@bifravst/bdd-markdown": "^8.2.70",
88-
"@bifravst/http-api-mock": "^2.1.247",
89-
"@hello.nrfcloud.com/nrfcloud-api-helpers": "^6.0.304",
90-
"@sinclair/typebox": "^0.34.38",
91-
"jsonata": "^2.0.6",
92-
"p-retry": "^6.2.1",
93-
"tsmatchers": "^5.0.3"
86+
"@aws-sdk/client-dynamodb": "^3.868.0",
87+
"@bifravst/bdd-markdown": "^8.2.74",
88+
"@bifravst/http-api-mock": "^2.1.267",
89+
"@hello.nrfcloud.com/nrfcloud-api-helpers": "^6.0.317",
90+
"@sinclair/typebox": "^0.34.39",
91+
"jsonata": "^2.1.0",
92+
"p-retry": "^6.2.1"
9493
}
9594
}

src/REST.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
import { Type } from '@sinclair/typebox'
77
import jsonata from 'jsonata'
88
import assert from 'node:assert/strict'
9-
import { check, objectMatching } from 'tsmatchers'
109
import { doRequest } from './lib/doRequest.js'
1110

1211
let currentRequest: ReturnType<typeof doRequest> = {
@@ -88,11 +87,9 @@ export const steps: StepRunner<Record<string, any>>[] = [
8887
},
8988
async ({ match: { context } }) => {
9089
await currentRequest.match(async ({ body }) =>
91-
check(body).is(
92-
objectMatching({
93-
'@context': context,
94-
}),
95-
),
90+
assert.partialDeepStrictEqual(body, {
91+
'@context': context,
92+
}),
9693
)
9794
},
9895
),
@@ -106,7 +103,7 @@ export const steps: StepRunner<Record<string, any>>[] = [
106103
},
107104
async ({ match: { statusCode } }) => {
108105
await currentRequest.match(async ({ response }) =>
109-
check(parseInt(statusCode, 10)).is(response.status),
106+
assert.equal(parseInt(statusCode, 10), response.status),
110107
)
111108
},
112109
),
@@ -141,9 +138,9 @@ export const steps: StepRunner<Record<string, any>>[] = [
141138
if (exp !== undefined) {
142139
const e = jsonata(exp)
143140
const result = await e.evaluate(body)
144-
check(result).is(objectMatching(expected))
141+
assert.partialDeepStrictEqual(result, expected)
145142
} else {
146-
check(body).is(objectMatching(expected))
143+
assert.partialDeepStrictEqual(body, expected)
147144
}
148145
})
149146
},

src/httpApiMock.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { parseMockResponse } from '@bifravst/http-api-mock/parseMockResponse'
99
import { listRequests } from '@bifravst/http-api-mock/requests'
1010
import { registerResponse } from '@bifravst/http-api-mock/responses'
1111
import { Type } from '@sinclair/typebox'
12+
import assert from 'node:assert/strict'
1213
import pRetry from 'p-retry'
13-
import { check, objectMatching } from 'tsmatchers'
1414

1515
export const steps = ({
1616
db,
@@ -88,9 +88,9 @@ export const steps = ({
8888
if (seenRequests.includes(request.requestId)) continue
8989
seenRequests.push(request.requestId)
9090
try {
91-
check(request.method).is(method)
92-
check(request.path).is(resource.slice(1))
93-
check(request.headers).is(objectMatching(headers))
91+
assert.equal(request.method, method)
92+
assert.equal(request.path, resource.slice(1))
93+
assert.partialDeepStrictEqual(request.headers, headers)
9494
const isJSON =
9595
Object.entries(request.headers)
9696
.map(([k, v]) => [k.toLowerCase(), v])
@@ -100,11 +100,12 @@ export const steps = ({
100100
) !== undefined
101101
if (isJSON) {
102102
progress('Body is JSON')
103-
check(JSON.parse(request.body)).is(
104-
objectMatching(JSON.parse(body)),
103+
assert.partialDeepStrictEqual(
104+
JSON.parse(request.body),
105+
JSON.parse(body),
105106
)
106107
} else {
107-
check(request.body).is(body)
108+
assert.equal(request.body, body)
108109
}
109110

110111
return

src/lib/doRequest.spec.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import assert from 'node:assert/strict'
22
import { describe, it, mock } from 'node:test'
3-
import { arrayContaining, check, objectMatching } from 'tsmatchers'
4-
import { doRequest } from './doRequest.js'
3+
import { doRequest, type AssertFn } from './doRequest.js'
54

65
void describe('doRequest()', () => {
76
void it('should execute a request', async () => {
@@ -14,7 +13,7 @@ void describe('doRequest()', () => {
1413
json: async () => Promise.resolve({ foo: 'bar' }),
1514
}),
1615
)
17-
const assertFn = mock.fn(async () => Promise.resolve())
16+
const assertFn = mock.fn<AssertFn>(async () => Promise.resolve())
1817

1918
const inFlight = doRequest(
2019
new URL('https://example.com'),
@@ -28,15 +27,14 @@ void describe('doRequest()', () => {
2827
await inFlight.match(assertFn)
2928
const mockArgs: [URL, RequestInit] =
3029
mockFetch.mock.calls[0]?.arguments ?? ([] as any)
31-
check(mockArgs[0].toString()).is(new URL('https://example.com').toString())
32-
check(mockArgs[1]).is(objectMatching({ method: 'POST' }))
33-
check(assertFn.mock.calls[0]?.arguments ?? []).is(
34-
arrayContaining(
35-
objectMatching({
36-
body: { foo: 'bar' },
37-
}),
38-
),
30+
assert.equal(
31+
mockArgs[0].toString(),
32+
new URL('https://example.com').toString(),
3933
)
34+
assert.partialDeepStrictEqual(mockArgs[1], { method: 'POST' })
35+
assert.partialDeepStrictEqual(assertFn.mock.calls[0]?.arguments?.[0], {
36+
body: { foo: 'bar' },
37+
})
4038
})
4139

4240
void it('should retry the request if the assert fails', async () => {
@@ -75,7 +73,7 @@ void describe('doRequest()', () => {
7573

7674
await inFlight.match(assertFn)
7775

78-
check(assertFn.mock.callCount()).is(2)
79-
check(mockFetch.mock.callCount()).is(2)
76+
assert.equal(assertFn.mock.callCount(), 2)
77+
assert.equal(mockFetch.mock.callCount(), 2)
8078
})
8179
})

src/lib/doRequest.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { type Logger } from '@bifravst/bdd-markdown'
22
import pRetry from 'p-retry'
33

4+
export type AssertFn = (args: Result) => Promise<unknown>
5+
46
type Result = {
57
response: Response
68
body?: Record<string, unknown>
@@ -14,7 +16,7 @@ export const doRequest = (
1416
numTries?: number
1517
},
1618
): {
17-
match: (assertFn: (args: Result) => Promise<unknown>) => Promise<void>
19+
match: (assertFn: AssertFn) => Promise<void>
1820
} => {
1921
let requestInFlight: Promise<Result> | undefined = undefined
2022

src/mocknRFCloud.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import {
2020
} from '@bifravst/http-api-mock/sortQueryString'
2121
import { getAllAccountsSettings } from '@hello.nrfcloud.com/nrfcloud-api-helpers/settings'
2222
import { Type } from '@sinclair/typebox'
23+
import assert from 'node:assert/strict'
2324
import { randomUUID } from 'node:crypto'
2425
import pRetry from 'p-retry'
25-
import { check, objectMatching, stringContaining } from 'tsmatchers'
2626

2727
export const steps = ({
2828
db,
@@ -161,14 +161,16 @@ export const steps = ({
161161
.map((item) => unmarshall(item))
162162
.find(({ body, headers }) => {
163163
try {
164-
progress(`body: ${body}`)
165-
check(body).is(expectedBody)
164+
assert.equal(body, expectedBody)
166165
} catch {
167166
return false
168167
}
169168
try {
170169
progress(`headers: ${headers}`)
171-
check(JSON.parse(headers)).is(objectMatching(request.headers))
170+
assert.partialDeepStrictEqual(
171+
JSON.parse(headers),
172+
request.headers,
173+
)
172174
} catch (err) {
173175
return false
174176
}
@@ -252,19 +254,20 @@ export const steps = ({
252254
)
253255
.find(({ query, headers }) => {
254256
try {
255-
check(query ?? {}).is(
256-
objectMatching({
257-
includeState: 'true',
258-
includeStateMeta: 'true',
259-
pageLimit: '100',
260-
deviceIds: stringContaining(deviceId),
261-
}),
257+
assert.partialDeepStrictEqual(query ?? {}, {
258+
includeState: 'true',
259+
includeStateMeta: 'true',
260+
pageLimit: '100',
261+
})
262+
assert.ok(
263+
(query ?? {})?.deviceIds?.includes(deviceId) === true,
264+
`Device ID ${deviceId} is not included in query`,
262265
)
263266
progress('headers', headers)
264-
check(JSON.parse(headers)).is(
265-
objectMatching({
266-
Authorization: stringContaining(expectedAPIKey),
267-
}),
267+
assert.ok(
268+
JSON.parse(headers)?.Authorization?.includes(expectedAPIKey) ===
269+
true,
270+
`Authorization header does not include expected API key`,
268271
)
269272
return true
270273
} catch {

0 commit comments

Comments
 (0)