Skip to content

Commit 334e058

Browse files
getlargeAlan-Cha
authored andcommitted
Fix async operation test problem
Signed-off-by: getlarge <[email protected]>
1 parent 6d22104 commit 334e058

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/openapi-to-graphql/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"build": "tsc",
4848
"guru-load": "node test/evaluation/load_apis_guru.js",
4949
"guru-test": "DEBUG=preprocessing,translation node test/evaluation/eval_apis_guru.js",
50-
"test": "npm run build && jest"
50+
"test": "npm run build && jest --runInBand --detectOpenHandles"
5151
},
5252
"husky": {
5353
"hooks": {

packages/openapi-to-graphql/test/example_api7_server.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
let httpServer
99
let mqttBroker
10+
let tcpServer
1011

1112
const Devices = {
1213
'Audio-player': {
@@ -42,7 +43,7 @@ function startServers(HTTP_PORT, MQTT_PORT) {
4243
}
4344
})
4445

45-
const tcpServer = require('net').createServer(mqttBroker.handle)
46+
tcpServer = require('net').createServer(mqttBroker.handle)
4647

4748
const bodyParser = require('body-parser')
4849
app.use(bodyParser.json())
@@ -150,7 +151,11 @@ function startServers(HTTP_PORT, MQTT_PORT) {
150151
* Stops server.
151152
*/
152153
function stopServers() {
153-
return Promise.all([httpServer.close(), mqttBroker.close()]).then(() => {
154+
return Promise.all([
155+
httpServer.close(),
156+
mqttBroker.close(),
157+
tcpServer.close()
158+
]).then(() => {
154159
console.log(`Stopped HTTP API server`)
155160
console.log(`Stopped MQTT API server`)
156161
})

0 commit comments

Comments
 (0)