browserstack-cypress-cli 1.36.15 → 1.36.16
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.
|
@@ -378,32 +378,35 @@ exports.setAccessibilityEventListeners = (bsConfig) => {
|
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
const globPattern = process.cwd() + supportFilesData.supportFile;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
381
|
+
// Synchronous for the same reason as testObservability setEventListeners
|
|
382
|
+
// (SDK-7121): the caller archives the suite right after this returns, so an
|
|
383
|
+
// async glob callback would race the archive and ship un-instrumented specs.
|
|
384
|
+
let files;
|
|
385
|
+
try {
|
|
386
|
+
files = glob.sync(globPattern, {});
|
|
387
|
+
} catch(err) {
|
|
388
|
+
logger.debug('EXCEPTION IN BUILD START EVENT : Unable to parse cypress support files', true, err);
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
files.forEach(file => {
|
|
392
|
+
try {
|
|
393
|
+
const fileName = path.basename(file);
|
|
394
|
+
if(['e2e.js', 'e2e.ts', 'component.ts', 'component.js'].includes(fileName) && !file.includes('node_modules')) {
|
|
395
|
+
|
|
396
|
+
const defaultFileContent = fs.readFileSync(file, {encoding: 'utf-8'});
|
|
397
|
+
let cypressCommandEventListener = getAccessibilityCypressCommandEventListener(path.extname(file));
|
|
398
|
+
if(!defaultFileContent.includes(cypressCommandEventListener)) {
|
|
399
|
+
let newFileContent = defaultFileContent +
|
|
400
|
+
'\n' +
|
|
401
|
+
cypressCommandEventListener +
|
|
402
|
+
'\n';
|
|
403
|
+
fs.writeFileSync(file, newFileContent, {encoding: 'utf-8'});
|
|
404
|
+
supportFileContentMap[file] = supportFilesData.cleanupParams ? supportFilesData.cleanupParams : defaultFileContent;
|
|
402
405
|
}
|
|
403
|
-
} catch(e) {
|
|
404
|
-
logger.debug(`Unable to modify file contents for ${file} to set event listeners with error ${e}`, true, e);
|
|
405
406
|
}
|
|
406
|
-
})
|
|
407
|
+
} catch(e) {
|
|
408
|
+
logger.debug(`Unable to modify file contents for ${file} to set event listeners with error ${e}`, true, e);
|
|
409
|
+
}
|
|
407
410
|
});
|
|
408
411
|
} catch(e) {
|
|
409
412
|
logger.debug(`Unable to parse support files to set event listeners with error ${e}`, true, e);
|
|
@@ -301,27 +301,29 @@ exports.setEventListeners = (bsConfig) => {
|
|
|
301
301
|
try {
|
|
302
302
|
const supportFilesData = helper.getSupportFiles(bsConfig, false);
|
|
303
303
|
if(!supportFilesData.supportFile) return;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
304
|
+
// Must be synchronous: runs.js proceeds to md5 hashing and zip archiving
|
|
305
|
+
// immediately after this returns. An async glob callback races the archive
|
|
306
|
+
// (SDK-7121) — a lost race ships an un-instrumented suite, and md5 caching
|
|
307
|
+
// makes it sticky, so TRA receives no test events.
|
|
308
|
+
const files = glob.sync(process.cwd() + supportFilesData.supportFile, {});
|
|
309
|
+
files.forEach(file => {
|
|
310
|
+
try {
|
|
311
|
+
if (isE2ESupportFile(file) || !files.some(f => isE2ESupportFile(f))) {
|
|
312
|
+
const defaultFileContent = fs.readFileSync(file, {encoding: 'utf-8'});
|
|
313
|
+
|
|
314
|
+
let cypressCommandEventListener = getCypressCommandEventListener(file.includes('js'));
|
|
315
|
+
if(!defaultFileContent.includes(cypressCommandEventListener)) {
|
|
316
|
+
let newFileContent = defaultFileContent +
|
|
317
|
+
'\n' +
|
|
318
|
+
cypressCommandEventListener +
|
|
319
|
+
'\n'
|
|
320
|
+
fs.writeFileSync(file, newFileContent, {encoding: 'utf-8'});
|
|
321
|
+
supportFileContentMap[file] = supportFilesData.cleanupParams ? supportFilesData.cleanupParams : defaultFileContent;
|
|
320
322
|
}
|
|
321
|
-
} catch(e) {
|
|
322
|
-
exports.debug(`Unable to modify file contents for ${file} to set event listeners with error ${e}`, true, e);
|
|
323
323
|
}
|
|
324
|
-
})
|
|
324
|
+
} catch(e) {
|
|
325
|
+
exports.debug(`Unable to modify file contents for ${file} to set event listeners with error ${e}`, true, e);
|
|
326
|
+
}
|
|
325
327
|
});
|
|
326
328
|
} catch(e) {
|
|
327
329
|
exports.debug(`Unable to parse support files to set event listeners with error ${e}`, true, e);
|