Skip to content

Commit 522039b

Browse files
committed
fixed detect-port and and stopServer after each spec runs
1 parent 9705488 commit 522039b

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

bin/testObservability/reporter/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class MyReporter {
209209
}
210210

211211
await this.uploadTestSteps();
212+
this.stopHttpServer();
212213
});
213214
}
214215

@@ -277,6 +278,20 @@ class MyReporter {
277278
debugOnConsole(`Exception in starting reporter server : ${error}`);
278279
debug(`Exception in starting reporter server : ${error}`, true, error);
279280
}
281+
}
282+
283+
stopHttpServer() {
284+
if (this.httpServer) {
285+
try {
286+
this.httpServer.close(() => {
287+
debugOnConsole('Reporter HTTP server closed');
288+
});
289+
this.httpServer = null;
290+
} catch (error) {
291+
debugOnConsole(`Exception in stopping reporter server : ${error}`);
292+
debug(`Exception in stopping reporter server : ${error}`, true, error);
293+
}
294+
}
280295
}
281296

282297
registerListeners() {

bin/testhub/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const TESTHUB_CONSTANTS = require("./constants");
55
const testObservabilityHelper = require("../../bin/testObservability/helper/helper");
66
const helper = require("../helpers/helper");
77
const accessibilityHelper = require("../accessibility-automation/helper");
8-
const { detect } = require('detect-port');
8+
const detect = require('detect-port');
99

1010

1111
const isUndefined = (value) => value === undefined || value === null;

0 commit comments

Comments
 (0)