@atproto/tap 0.3.1 → 0.3.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atproto/tap
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5117](https://github.com/bluesky-social/atproto/pull/5117) [`8a4c88b`](https://github.com/bluesky-social/atproto/commit/8a4c88b0f63fb2d82b1391d64c54e0c760fac48b) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Make tests less flaky in CI
8
+
9
+ - Updated dependencies [[`8a4c88b`](https://github.com/bluesky-social/atproto/commit/8a4c88b0f63fb2d82b1391d64c54e0c760fac48b)]:
10
+ - @atproto/ws-client@0.1.2
11
+
3
12
  ## 0.3.1
4
13
 
5
14
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/tap",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "license": "MIT",
5
5
  "description": "atproto tap client",
6
6
  "keywords": [
@@ -24,13 +24,14 @@
24
24
  "@atproto/common": "^0.6.3",
25
25
  "@atproto/lex": "^0.1.4",
26
26
  "@atproto/syntax": "^0.6.2",
27
- "@atproto/ws-client": "^0.1.1"
27
+ "@atproto/ws-client": "^0.1.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/express": "^4.17.17",
31
31
  "@types/ws": "^8.5.4",
32
- "express": "^4.18.2",
33
32
  "@vitest/coverage-v8": "4.0.16",
33
+ "express": "^4.18.2",
34
+ "http-terminator": "^3.2.0",
34
35
  "vitest": "^4.0.16"
35
36
  },
36
37
  "type": "module",
@@ -2,6 +2,8 @@ import { once } from 'node:events'
2
2
  import * as http from 'node:http'
3
3
  import { AddressInfo } from 'node:net'
4
4
  import { default as express } from 'express'
5
+ // eslint-disable-next-line import/default
6
+ import httpTerminator from 'http-terminator'
5
7
  import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
6
8
  import { Tap } from '../src/client.js'
7
9
 
@@ -28,10 +30,7 @@ describe('Tap client', () => {
28
30
  })
29
31
 
30
32
  describe('HTTP methods', () => {
31
- let server: http.Server<
32
- typeof http.IncomingMessage,
33
- typeof http.ServerResponse
34
- >
33
+ let terminator: httpTerminator.HttpTerminator
35
34
  let tap: Tap
36
35
  let requests: {
37
36
  path: string
@@ -99,14 +98,15 @@ describe('Tap client', () => {
99
98
  })
100
99
  })
101
100
 
102
- server = app.listen()
101
+ const server = app.listen()
103
102
  await once(server, 'listening')
104
103
  const { port } = server.address() as AddressInfo
104
+ terminator = httpTerminator.createHttpTerminator({ server })
105
105
  tap = new Tap(`http://localhost:${port}`, { adminPassword: 'secret' })
106
106
  })
107
107
 
108
108
  afterAll(async () => {
109
- await new Promise((resolve) => server.close(resolve))
109
+ await terminator?.terminate()
110
110
  })
111
111
 
112
112
  beforeEach(() => {
@@ -166,10 +166,7 @@ describe('Tap client', () => {
166
166
  })
167
167
 
168
168
  describe('HTTP error handling', () => {
169
- let server: http.Server<
170
- typeof http.IncomingMessage,
171
- typeof http.ServerResponse
172
- >
169
+ let terminator: httpTerminator.HttpTerminator
173
170
  let tap: Tap
174
171
 
175
172
  beforeAll(async () => {
@@ -184,14 +181,15 @@ describe('Tap client', () => {
184
181
  res.status(500).send('Internal Server Error')
185
182
  })
186
183
 
187
- server = app.listen()
184
+ const server = app.listen(0)
188
185
  await once(server, 'listening')
189
186
  const { port } = server.address() as AddressInfo
187
+ terminator = httpTerminator.createHttpTerminator({ server })
190
188
  tap = new Tap(`http://localhost:${port}`)
191
189
  })
192
190
 
193
191
  afterAll(async () => {
194
- await new Promise((resolve) => server.close(resolve))
192
+ await terminator?.terminate()
195
193
  })
196
194
 
197
195
  it('throws on addRepos failure', async () => {