browserstack-cypress-cli 1.35.0 → 1.36.0
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.
|
@@ -284,6 +284,10 @@ const getCypressCommandEventListener = (isJS) => {
|
|
|
284
284
|
)
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
const isE2ESupportFile = (file) => {
|
|
288
|
+
return file.includes('e2e.js') || file.includes('e2e.ts');
|
|
289
|
+
}
|
|
290
|
+
|
|
287
291
|
exports.setEventListeners = (bsConfig) => {
|
|
288
292
|
try {
|
|
289
293
|
const supportFilesData = helper.getSupportFiles(bsConfig, false);
|
|
@@ -292,7 +296,7 @@ exports.setEventListeners = (bsConfig) => {
|
|
|
292
296
|
if(err) return exports.debug('EXCEPTION IN BUILD START EVENT : Unable to parse cypress support files');
|
|
293
297
|
files.forEach(file => {
|
|
294
298
|
try {
|
|
295
|
-
if(!
|
|
299
|
+
if (isE2ESupportFile(file) || !files.some(f => isE2ESupportFile(f))) {
|
|
296
300
|
const defaultFileContent = fs.readFileSync(file, {encoding: 'utf-8'});
|
|
297
301
|
|
|
298
302
|
let cypressCommandEventListener = getCypressCommandEventListener(file.includes('js'));
|
|
@@ -270,6 +270,16 @@ class MyReporter {
|
|
|
270
270
|
|
|
271
271
|
const port = process.env.REPORTER_API_PORT_NO;
|
|
272
272
|
|
|
273
|
+
this.httpServer.on('error', (error) => {
|
|
274
|
+
if (error.code === 'EADDRINUSE') {
|
|
275
|
+
debugOnConsole(`Port ${port} is already in use. HTTP server could not start.`);
|
|
276
|
+
debug(`Port ${port} is already in use. HTTP server could not start.`, true, error);
|
|
277
|
+
} else {
|
|
278
|
+
debugOnConsole(`Exception in starting reporter server : ${error}`);
|
|
279
|
+
debug(`Exception in starting reporter server : ${error}`, true, error);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
|
|
273
283
|
this.httpServer.listen(port, '127.0.0.1', async () => {
|
|
274
284
|
console.log(`Reporter HTTP server listening on port ${port}`);
|
|
275
285
|
});
|
package/bin/testhub/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ const TESTHUB_CONSTANTS = require("./constants");
|
|
|
5
5
|
const testObservabilityHelper = require("../../bin/testObservability/helper/helper");
|
|
6
6
|
const helper = require("../helpers/helper");
|
|
7
7
|
const accessibilityHelper = require("../accessibility-automation/helper");
|
|
8
|
-
const
|
|
8
|
+
const detectPort = require('detect-port');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
const isUndefined = (value) => value === undefined || value === null;
|
|
@@ -195,17 +195,18 @@ exports.logBuildError = (error, product = "") => {
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
-
exports.findAvailablePort = async (preferredPort, maxAttempts = 10) => {
|
|
198
|
+
exports.findAvailablePort = async (preferredPort, maxAttempts = 10) => {
|
|
199
|
+
const findPort = detectPort.detect || detectPort;
|
|
199
200
|
let port = preferredPort;
|
|
200
201
|
for (let attempts = 0; attempts < maxAttempts; attempts++) {
|
|
201
202
|
try {
|
|
202
|
-
const availablePort = await
|
|
203
|
+
const availablePort = await findPort(port);
|
|
203
204
|
|
|
204
205
|
if (availablePort === port) {
|
|
205
206
|
return port;
|
|
206
207
|
} else {
|
|
207
208
|
// Double-check suggested port
|
|
208
|
-
const verify = await
|
|
209
|
+
const verify = await findPort(availablePort);
|
|
209
210
|
if (verify === availablePort) {
|
|
210
211
|
return availablePort;
|
|
211
212
|
}
|