fastify 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,17 @@
1
1
  'use strict'
2
2
 
3
- const t = require('tap')
4
- const test = t.test
3
+ const { test } = require('node:test')
5
4
  const sget = require('simple-get').concat
6
- const Fastify = require('../fastify')
5
+ const Fastify = require('..')
7
6
  const jsonParser = require('fast-json-body')
8
7
  const { getServerUrl } = require('./helper')
9
8
 
10
9
  process.removeAllListeners('warning')
11
10
 
12
- test('should be able to use default parser for extra content type', t => {
11
+ test('should be able to use default parser for extra content type', (t, done) => {
13
12
  t.plan(4)
14
13
  const fastify = Fastify()
15
- t.teardown(() => fastify.close())
14
+ t.after(() => fastify.close())
16
15
 
17
16
  fastify.post('/', (request, reply) => {
18
17
  reply.send(request.body)
@@ -21,7 +20,7 @@ test('should be able to use default parser for extra content type', t => {
21
20
  fastify.addContentTypeParser('text/json', { parseAs: 'string' }, fastify.getDefaultJsonParser('ignore', 'ignore'))
22
21
 
23
22
  fastify.listen({ port: 0 }, err => {
24
- t.error(err)
23
+ t.assert.ifError(err)
25
24
 
26
25
  sget({
27
26
  method: 'POST',
@@ -31,18 +30,17 @@ test('should be able to use default parser for extra content type', t => {
31
30
  'Content-Type': 'text/json'
32
31
  }
33
32
  }, (err, response, body) => {
34
- t.error(err)
35
- t.equal(response.statusCode, 200)
36
- t.strictSame(JSON.parse(body.toString()), { hello: 'world' })
37
- fastify.close()
33
+ t.assert.ifError(err)
34
+ t.assert.strictEqual(response.statusCode, 200)
35
+ t.assert.deepStrictEqual(JSON.parse(body.toString()), { hello: 'world' })
36
+ done()
38
37
  })
39
38
  })
40
39
  })
41
40
 
42
- test('contentTypeParser should add a custom parser with RegExp value', t => {
43
- t.plan(3)
44
-
41
+ test('contentTypeParser should add a custom parser with RegExp value', async (t) => {
45
42
  const fastify = Fastify()
43
+ t.after(() => fastify.close())
46
44
 
47
45
  fastify.post('/', (req, reply) => {
48
46
  reply.send(req.body)
@@ -58,13 +56,12 @@ test('contentTypeParser should add a custom parser with RegExp value', t => {
58
56
  })
59
57
  })
60
58
 
61
- fastify.listen({ port: 0 }, err => {
62
- t.error(err)
63
-
64
- t.teardown(() => fastify.close())
59
+ fastify.listen({ port: 0 }, async err => {
60
+ t.assert.ifError(err)
65
61
 
66
- t.test('in POST', t => {
62
+ await t.test('in POST', (t, done) => {
67
63
  t.plan(3)
64
+ t.after(() => fastify.close())
68
65
 
69
66
  sget({
70
67
  method: 'POST',
@@ -74,14 +71,16 @@ test('contentTypeParser should add a custom parser with RegExp value', t => {
74
71
  'Content-Type': 'application/vnd.test+json'
75
72
  }
76
73
  }, (err, response, body) => {
77
- t.error(err)
78
- t.equal(response.statusCode, 200)
79
- t.same(body.toString(), JSON.stringify({ hello: 'world' }))
74
+ t.assert.ifError(err)
75
+ t.assert.strictEqual(response.statusCode, 200)
76
+ t.assert.deepStrictEqual(body.toString(), JSON.stringify({ hello: 'world' }))
77
+ done()
80
78
  })
81
79
  })
82
80
 
83
- t.test('in OPTIONS', t => {
81
+ await t.test('in OPTIONS', (t, done) => {
84
82
  t.plan(3)
83
+ t.after(() => fastify.close())
85
84
 
86
85
  sget({
87
86
  method: 'OPTIONS',
@@ -91,9 +90,10 @@ test('contentTypeParser should add a custom parser with RegExp value', t => {
91
90
  'Content-Type': 'weird/content-type+json'
92
91
  }
93
92
  }, (err, response, body) => {
94
- t.error(err)
95
- t.equal(response.statusCode, 200)
96
- t.same(body.toString(), JSON.stringify({ hello: 'world' }))
93
+ t.assert.ifError(err)
94
+ t.assert.strictEqual(response.statusCode, 200)
95
+ t.assert.deepStrictEqual(body.toString(), JSON.stringify({ hello: 'world' }))
96
+ done()
97
97
  })
98
98
  })
99
99
  })
@@ -102,7 +102,7 @@ test('contentTypeParser should add a custom parser with RegExp value', t => {
102
102
  test('contentTypeParser should add multiple custom parsers with RegExp values', async t => {
103
103
  t.plan(6)
104
104
  const fastify = Fastify()
105
- t.teardown(fastify.close.bind(fastify))
105
+ t.after(() => fastify.close())
106
106
 
107
107
  fastify.post('/', (req, reply) => {
108
108
  reply.send(req.body)
@@ -137,8 +137,8 @@ test('contentTypeParser should add multiple custom parsers with RegExp values',
137
137
  'Content-Type': 'application/vnd.hello+json'
138
138
  }
139
139
  })
140
- t.equal(response.statusCode, 200)
141
- t.same(response.payload.toString(), '{"hello":"world"}')
140
+ t.assert.strictEqual(response.statusCode, 200)
141
+ t.assert.deepStrictEqual(response.payload.toString(), '{"hello":"world"}')
142
142
  }
143
143
 
144
144
  {
@@ -150,8 +150,8 @@ test('contentTypeParser should add multiple custom parsers with RegExp values',
150
150
  'Content-Type': 'application/test+xml'
151
151
  }
152
152
  })
153
- t.equal(response.statusCode, 200)
154
- t.same(response.payload.toString(), 'xml')
153
+ t.assert.strictEqual(response.statusCode, 200)
154
+ t.assert.deepStrictEqual(response.payload.toString(), 'xml')
155
155
  }
156
156
 
157
157
  await fastify.inject({
@@ -162,17 +162,17 @@ test('contentTypeParser should add multiple custom parsers with RegExp values',
162
162
  'Content-Type': 'application/+myExtension'
163
163
  }
164
164
  }).then((response) => {
165
- t.equal(response.statusCode, 200)
166
- t.same(response.payload.toString(), 'abcdefgmyExtension')
165
+ t.assert.strictEqual(response.statusCode, 200)
166
+ t.assert.deepStrictEqual(response.payload.toString(), 'abcdefgmyExtension')
167
167
  }).catch((err) => {
168
- t.error(err)
168
+ t.assert.ifError(err)
169
169
  })
170
170
  })
171
171
 
172
- test('catch all content type parser should not interfere with content type parser', t => {
172
+ test('catch all content type parser should not interfere with content type parser', (t, done) => {
173
173
  t.plan(10)
174
174
  const fastify = Fastify()
175
- t.teardown(fastify.close.bind(fastify))
175
+ t.after(() => fastify.close())
176
176
 
177
177
  fastify.post('/', (req, reply) => {
178
178
  reply.send(req.body)
@@ -201,7 +201,15 @@ test('catch all content type parser should not interfere with content type parse
201
201
  })
202
202
 
203
203
  fastify.listen({ port: 0 }, err => {
204
- t.error(err)
204
+ t.assert.ifError(err)
205
+
206
+ let pending = 3
207
+
208
+ function completed () {
209
+ if (--pending === 0) {
210
+ done()
211
+ }
212
+ }
205
213
 
206
214
  sget({
207
215
  method: 'POST',
@@ -211,9 +219,10 @@ test('catch all content type parser should not interfere with content type parse
211
219
  'Content-Type': 'application/json'
212
220
  }
213
221
  }, (err, response, body) => {
214
- t.error(err)
215
- t.equal(response.statusCode, 200)
216
- t.same(body.toString(), JSON.stringify({ myKey: 'myValue' }))
222
+ t.assert.ifError(err)
223
+ t.assert.strictEqual(response.statusCode, 200)
224
+ t.assert.deepStrictEqual(body.toString(), JSON.stringify({ myKey: 'myValue' }))
225
+ completed()
217
226
  })
218
227
 
219
228
  sget({
@@ -224,9 +233,10 @@ test('catch all content type parser should not interfere with content type parse
224
233
  'Content-Type': 'very-weird-content-type'
225
234
  }
226
235
  }, (err, response, body) => {
227
- t.error(err)
228
- t.equal(response.statusCode, 200)
229
- t.same(body.toString(), 'body')
236
+ t.assert.ifError(err)
237
+ t.assert.strictEqual(response.statusCode, 200)
238
+ t.assert.deepStrictEqual(body.toString(), 'body')
239
+ completed()
230
240
  })
231
241
 
232
242
  sget({
@@ -237,9 +247,10 @@ test('catch all content type parser should not interfere with content type parse
237
247
  'Content-Type': 'text/html'
238
248
  }
239
249
  }, (err, response, body) => {
240
- t.error(err)
241
- t.equal(response.statusCode, 200)
242
- t.same(body.toString(), 'my texthtml')
250
+ t.assert.ifError(err)
251
+ t.assert.strictEqual(response.statusCode, 200)
252
+ t.assert.deepStrictEqual(body.toString(), 'my texthtml')
253
+ completed()
243
254
  })
244
255
  })
245
256
  })
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- const t = require('tap')
4
- const test = t.test
3
+ const assert = require('node:assert')
4
+ const { test } = require('node:test')
5
5
  const sget = require('simple-get').concat
6
6
  const fastify = require('..')()
7
7
 
@@ -85,15 +85,17 @@ const bodySchema = {
85
85
  }
86
86
  }
87
87
 
88
- test('shorthand - delete', t => {
88
+ test('shorthand - delete', (t, done) => {
89
89
  t.plan(1)
90
90
  try {
91
91
  fastify.delete('/', schema, function (req, reply) {
92
92
  reply.code(200).send({ hello: 'world' })
93
93
  })
94
- t.pass()
94
+ t.assert.ok(true)
95
95
  } catch (e) {
96
- t.fail()
96
+ t.assert.fail()
97
+ } finally {
98
+ done()
97
99
  }
98
100
  })
99
101
 
@@ -103,9 +105,9 @@ test('shorthand - delete params', t => {
103
105
  fastify.delete('/params/:foo/:test', paramsSchema, function (req, reply) {
104
106
  reply.code(200).send(req.params)
105
107
  })
106
- t.pass()
108
+ t.assert.ok(true)
107
109
  } catch (e) {
108
- t.fail()
110
+ t.assert.fail()
109
111
  }
110
112
  })
111
113
 
@@ -115,9 +117,9 @@ test('shorthand - delete, querystring schema', t => {
115
117
  fastify.delete('/query', querySchema, function (req, reply) {
116
118
  reply.send(req.query)
117
119
  })
118
- t.pass()
120
+ t.assert.ok(true)
119
121
  } catch (e) {
120
- t.fail()
122
+ t.assert.fail()
121
123
  }
122
124
  })
123
125
 
@@ -127,9 +129,9 @@ test('shorthand - get, headers schema', t => {
127
129
  fastify.delete('/headers', headersSchema, function (req, reply) {
128
130
  reply.code(200).send(req.headers)
129
131
  })
130
- t.pass()
132
+ t.assert.ok(true)
131
133
  } catch (e) {
132
- t.fail()
134
+ t.assert.fail()
133
135
  }
134
136
  })
135
137
 
@@ -139,9 +141,9 @@ test('missing schema - delete', t => {
139
141
  fastify.delete('/missing', function (req, reply) {
140
142
  reply.code(200).send({ hello: 'world' })
141
143
  })
142
- t.pass()
144
+ t.assert.ok(true)
143
145
  } catch (e) {
144
- t.fail()
146
+ t.assert.fail()
145
147
  }
146
148
  })
147
149
 
@@ -151,60 +153,63 @@ test('body - delete', t => {
151
153
  fastify.delete('/body', bodySchema, function (req, reply) {
152
154
  reply.send(req.body)
153
155
  })
154
- t.pass()
156
+ t.assert.ok(true)
155
157
  } catch (e) {
156
- t.fail()
158
+ t.assert.fail()
157
159
  }
158
160
  })
159
161
 
160
162
  fastify.listen({ port: 0 }, err => {
161
- t.error(err)
162
- t.teardown(() => { fastify.close() })
163
+ assert.ifError(err)
164
+ test.after(() => { fastify.close() })
163
165
 
164
- test('shorthand - request delete', t => {
166
+ test('shorthand - request delete', (t, done) => {
165
167
  t.plan(4)
166
168
  sget({
167
169
  method: 'DELETE',
168
170
  url: 'http://localhost:' + fastify.server.address().port
169
171
  }, (err, response, body) => {
170
- t.error(err)
171
- t.equal(response.statusCode, 200)
172
- t.equal(response.headers['content-length'], '' + body.length)
173
- t.same(JSON.parse(body), { hello: 'world' })
172
+ t.assert.ifError(err)
173
+ t.assert.strictEqual(response.statusCode, 200)
174
+ t.assert.strictEqual(response.headers['content-length'], '' + body.length)
175
+ t.assert.deepStrictEqual(JSON.parse(body), { hello: 'world' })
176
+ done()
174
177
  })
175
178
  })
176
179
 
177
- test('shorthand - request delete params schema', t => {
180
+ test('shorthand - request delete params schema', (t, done) => {
178
181
  t.plan(4)
179
182
  sget({
180
183
  method: 'DELETE',
181
184
  url: 'http://localhost:' + fastify.server.address().port + '/params/world/123'
182
185
  }, (err, response, body) => {
183
- t.error(err)
184
- t.equal(response.statusCode, 200)
185
- t.equal(response.headers['content-length'], '' + body.length)
186
- t.same(JSON.parse(body), { foo: 'world', test: 123 })
186
+ t.assert.ifError(err)
187
+ t.assert.strictEqual(response.statusCode, 200)
188
+ t.assert.strictEqual(response.headers['content-length'], '' + body.length)
189
+ t.assert.deepStrictEqual(JSON.parse(body), { foo: 'world', test: 123 })
190
+ done()
187
191
  })
188
192
  })
189
193
 
190
- test('shorthand - request delete params schema error', t => {
194
+ test('shorthand - request delete params schema error', (t, done) => {
191
195
  t.plan(3)
192
196
  sget({
193
197
  method: 'DELETE',
194
198
  url: 'http://localhost:' + fastify.server.address().port + '/params/world/string'
195
199
  }, (err, response, body) => {
196
- t.error(err)
197
- t.equal(response.statusCode, 400)
198
- t.same(JSON.parse(body), {
200
+ t.assert.ifError(err)
201
+ t.assert.strictEqual(response.statusCode, 400)
202
+ t.assert.deepStrictEqual(JSON.parse(body), {
199
203
  error: 'Bad Request',
200
204
  code: 'FST_ERR_VALIDATION',
201
205
  message: 'params/test must be integer',
202
206
  statusCode: 400
203
207
  })
208
+ done()
204
209
  })
205
210
  })
206
211
 
207
- test('shorthand - request delete headers schema', t => {
212
+ test('shorthand - request delete headers schema', (t, done) => {
208
213
  t.plan(4)
209
214
  sget({
210
215
  method: 'DELETE',
@@ -213,14 +218,15 @@ fastify.listen({ port: 0 }, err => {
213
218
  },
214
219
  url: 'http://localhost:' + fastify.server.address().port + '/headers'
215
220
  }, (err, response, body) => {
216
- t.error(err)
217
- t.equal(response.statusCode, 200)
218
- t.equal(response.headers['content-length'], '' + body.length)
219
- t.equal(JSON.parse(body)['x-test'], 1)
221
+ t.assert.ifError(err)
222
+ t.assert.strictEqual(response.statusCode, 200)
223
+ t.assert.strictEqual(response.headers['content-length'], '' + body.length)
224
+ t.assert.strictEqual(JSON.parse(body)['x-test'], 1)
225
+ done()
220
226
  })
221
227
  })
222
228
 
223
- test('shorthand - request delete headers schema error', t => {
229
+ test('shorthand - request delete headers schema error', (t, done) => {
224
230
  t.plan(3)
225
231
  sget({
226
232
  method: 'DELETE',
@@ -229,61 +235,65 @@ fastify.listen({ port: 0 }, err => {
229
235
  },
230
236
  url: 'http://localhost:' + fastify.server.address().port + '/headers'
231
237
  }, (err, response, body) => {
232
- t.error(err)
233
- t.equal(response.statusCode, 400)
234
- t.same(JSON.parse(body), {
238
+ t.assert.ifError(err)
239
+ t.assert.strictEqual(response.statusCode, 400)
240
+ t.assert.deepStrictEqual(JSON.parse(body), {
235
241
  error: 'Bad Request',
236
242
  code: 'FST_ERR_VALIDATION',
237
243
  message: 'headers/x-test must be number',
238
244
  statusCode: 400
239
245
  })
246
+ done()
240
247
  })
241
248
  })
242
249
 
243
- test('shorthand - request delete querystring schema', t => {
250
+ test('shorthand - request delete querystring schema', (t, done) => {
244
251
  t.plan(4)
245
252
  sget({
246
253
  method: 'DELETE',
247
254
  url: 'http://localhost:' + fastify.server.address().port + '/query?hello=123'
248
255
  }, (err, response, body) => {
249
- t.error(err)
250
- t.equal(response.statusCode, 200)
251
- t.equal(response.headers['content-length'], '' + body.length)
252
- t.same(JSON.parse(body), { hello: 123 })
256
+ t.assert.ifError(err)
257
+ t.assert.strictEqual(response.statusCode, 200)
258
+ t.assert.strictEqual(response.headers['content-length'], '' + body.length)
259
+ t.assert.deepStrictEqual(JSON.parse(body), { hello: 123 })
260
+ done()
253
261
  })
254
262
  })
255
263
 
256
- test('shorthand - request delete querystring schema error', t => {
264
+ test('shorthand - request delete querystring schema error', (t, done) => {
257
265
  t.plan(3)
258
266
  sget({
259
267
  method: 'DELETE',
260
268
  url: 'http://localhost:' + fastify.server.address().port + '/query?hello=world'
261
269
  }, (err, response, body) => {
262
- t.error(err)
263
- t.equal(response.statusCode, 400)
264
- t.same(JSON.parse(body), {
270
+ t.assert.ifError(err)
271
+ t.assert.strictEqual(response.statusCode, 400)
272
+ t.assert.deepStrictEqual(JSON.parse(body), {
265
273
  error: 'Bad Request',
266
274
  code: 'FST_ERR_VALIDATION',
267
275
  message: 'querystring/hello must be integer',
268
276
  statusCode: 400
269
277
  })
278
+ done()
270
279
  })
271
280
  })
272
281
 
273
- test('shorthand - request delete missing schema', t => {
282
+ test('shorthand - request delete missing schema', (t, done) => {
274
283
  t.plan(4)
275
284
  sget({
276
285
  method: 'DELETE',
277
286
  url: 'http://localhost:' + fastify.server.address().port + '/missing'
278
287
  }, (err, response, body) => {
279
- t.error(err)
280
- t.equal(response.statusCode, 200)
281
- t.equal(response.headers['content-length'], '' + body.length)
282
- t.same(JSON.parse(body), { hello: 'world' })
288
+ t.assert.ifError(err)
289
+ t.assert.strictEqual(response.statusCode, 200)
290
+ t.assert.strictEqual(response.headers['content-length'], '' + body.length)
291
+ t.assert.deepStrictEqual(JSON.parse(body), { hello: 'world' })
292
+ done()
283
293
  })
284
294
  })
285
295
 
286
- test('shorthand - delete with body', t => {
296
+ test('shorthand - delete with body', (t, done) => {
287
297
  t.plan(3)
288
298
  sget({
289
299
  method: 'DELETE',
@@ -293,18 +303,19 @@ fastify.listen({ port: 0 }, err => {
293
303
  },
294
304
  json: true
295
305
  }, (err, response, body) => {
296
- t.error(err)
297
- t.equal(response.statusCode, 200)
298
- t.same(body, { hello: 'world' })
306
+ t.assert.ifError(err)
307
+ t.assert.strictEqual(response.statusCode, 200)
308
+ t.assert.deepStrictEqual(body, { hello: 'world' })
309
+ done()
299
310
  })
300
311
  })
301
312
  })
302
313
 
303
- test('shorthand - delete with application/json Content-Type header and null body', t => {
314
+ test('shorthand - delete with application/json Content-Type header and null body', (t, done) => {
304
315
  t.plan(4)
305
316
  const fastify = require('..')()
306
317
  fastify.delete('/', {}, (req, reply) => {
307
- t.equal(req.body, null)
318
+ t.assert.strictEqual(req.body, null)
308
319
  reply.send(req.body)
309
320
  })
310
321
  fastify.inject({
@@ -313,9 +324,10 @@ test('shorthand - delete with application/json Content-Type header and null body
313
324
  headers: { 'Content-Type': 'application/json' },
314
325
  body: 'null'
315
326
  }, (err, response) => {
316
- t.error(err)
317
- t.equal(response.statusCode, 200)
318
- t.same(response.payload.toString(), 'null')
327
+ t.assert.ifError(err)
328
+ t.assert.strictEqual(response.statusCode, 200)
329
+ t.assert.strictEqual(response.payload.toString(), 'null')
330
+ done()
319
331
  })
320
332
  })
321
333
 
@@ -325,7 +337,7 @@ test('shorthand - delete with application/json Content-Type header and without b
325
337
  t.plan(4)
326
338
  const fastify = require('..')()
327
339
  fastify.delete('/', {}, (req, reply) => {
328
- t.equal(req.body, undefined)
340
+ t.assert.strictEqual(req.body, undefined)
329
341
  reply.send(req.body)
330
342
  })
331
343
  fastify.inject({
@@ -334,8 +346,8 @@ test('shorthand - delete with application/json Content-Type header and without b
334
346
  headers: { 'Content-Type': 'application/json' },
335
347
  body: null
336
348
  }, (err, response) => {
337
- t.error(err)
338
- t.equal(response.statusCode, 200)
339
- t.same(response.payload.toString(), '')
349
+ t.assert.ifError(err)
350
+ t.assert.strictEqual(response.statusCode, 200)
351
+ t.assert.strictEqual(response.payload.toString(), '')
340
352
  })
341
353
  })
@@ -5,7 +5,9 @@ const errors = require('../../lib/errors')
5
5
  const { readFileSync } = require('node:fs')
6
6
  const { resolve } = require('node:path')
7
7
 
8
- test('should expose 83 errors', t => {
8
+ const expectedErrors = 84
9
+
10
+ test(`should expose ${expectedErrors} errors`, t => {
9
11
  t.plan(1)
10
12
  const exportedKeys = Object.keys(errors)
11
13
  let counter = 0
@@ -14,11 +16,11 @@ test('should expose 83 errors', t => {
14
16
  counter++
15
17
  }
16
18
  }
17
- t.assert.strictEqual(counter, 83)
19
+ t.assert.strictEqual(counter, expectedErrors)
18
20
  })
19
21
 
20
22
  test('ensure name and codes of Errors are identical', t => {
21
- t.plan(83)
23
+ t.plan(expectedErrors)
22
24
  const exportedKeys = Object.keys(errors)
23
25
  for (const key of exportedKeys) {
24
26
  if (errors[key].name === 'FastifyError') {
@@ -377,6 +379,16 @@ test('FST_ERR_REP_RESPONSE_BODY_CONSUMED', t => {
377
379
  t.assert.ok(error instanceof Error)
378
380
  })
379
381
 
382
+ test('FST_ERR_REP_READABLE_STREAM_LOCKED', t => {
383
+ t.plan(5)
384
+ const error = new errors.FST_ERR_REP_READABLE_STREAM_LOCKED()
385
+ t.assert.strictEqual(error.name, 'FastifyError')
386
+ t.assert.strictEqual(error.code, 'FST_ERR_REP_READABLE_STREAM_LOCKED')
387
+ t.assert.strictEqual(error.message, 'ReadableStream was locked. You should call releaseLock() method on reader before sending.')
388
+ t.assert.strictEqual(error.statusCode, 500)
389
+ t.assert.ok(error instanceof Error)
390
+ })
391
+
380
392
  test('FST_ERR_REP_ALREADY_SENT', t => {
381
393
  t.plan(5)
382
394
  const error = new errors.FST_ERR_REP_ALREADY_SENT('/hello', 'GET')
@@ -868,7 +880,7 @@ test('FST_ERR_ERROR_HANDLER_NOT_FN', t => {
868
880
  })
869
881
 
870
882
  test('Ensure that all errors are in Errors.md TOC', t => {
871
- t.plan(83)
883
+ t.plan(expectedErrors)
872
884
  const errorsMd = readFileSync(resolve(__dirname, '../../docs/Reference/Errors.md'), 'utf8')
873
885
 
874
886
  const exportedKeys = Object.keys(errors)
@@ -880,7 +892,7 @@ test('Ensure that all errors are in Errors.md TOC', t => {
880
892
  })
881
893
 
882
894
  test('Ensure that non-existing errors are not in Errors.md TOC', t => {
883
- t.plan(83)
895
+ t.plan(expectedErrors)
884
896
  const errorsMd = readFileSync(resolve(__dirname, '../../docs/Reference/Errors.md'), 'utf8')
885
897
 
886
898
  const matchRE = / {4}- \[([A-Z0-9_]+)\]\(#[a-z0-9_]+\)/g
@@ -893,7 +905,7 @@ test('Ensure that non-existing errors are not in Errors.md TOC', t => {
893
905
  })
894
906
 
895
907
  test('Ensure that all errors are in Errors.md documented', t => {
896
- t.plan(83)
908
+ t.plan(expectedErrors)
897
909
  const errorsMd = readFileSync(resolve(__dirname, '../../docs/Reference/Errors.md'), 'utf8')
898
910
 
899
911
  const exportedKeys = Object.keys(errors)
@@ -905,7 +917,7 @@ test('Ensure that all errors are in Errors.md documented', t => {
905
917
  })
906
918
 
907
919
  test('Ensure that non-existing errors are not in Errors.md documented', t => {
908
- t.plan(83)
920
+ t.plan(expectedErrors)
909
921
  const errorsMd = readFileSync(resolve(__dirname, '../../docs/Reference/Errors.md'), 'utf8')
910
922
 
911
923
  const matchRE = /<a id="[0-9a-zA-Z_]+">([0-9a-zA-Z_]+)<\/a>/g