Skip to content

Commit d7393d6

Browse files
committed
added olly artifact changes + added some logs
1 parent d603457 commit d7393d6

File tree

7 files changed

+86
-22
lines changed

7 files changed

+86
-22
lines changed

bin/commands/runs.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const { isTurboScaleSession, getTurboScaleGridDetails, patchCypressConfigFileCon
4040

4141

4242
module.exports = function run(args, rawArgs) {
43-
43+
utils.normalizeTestReportingEnvVars();
4444
markBlockStart('preBuild');
4545
// set debug mode (--cli-debug)
4646
utils.setDebugMode(args);
@@ -59,6 +59,9 @@ module.exports = function run(args, rawArgs) {
5959
return utils.validateBstackJson(bsConfigPath).then(async function (bsConfig) {
6060
markBlockEnd('validateBstackJson');
6161
logger.debug('Completed browserstack.json validation');
62+
63+
console.log("bsConfig after validation",bsConfig);
64+
6265
markBlockStart('setConfig');
6366
logger.debug('Started setting the configs');
6467

@@ -112,7 +115,9 @@ module.exports = function run(args, rawArgs) {
112115
// set build tag caps
113116
utils.setBuildTags(bsConfig, args);
114117

115-
// Send build start to Observability
118+
console.log(`checking if testObservability session is enabled line run() 118: ${isTestObservabilitySession}`);
119+
120+
// Send build start to TEST REPORTING AND ANALYTICS
116121
if(isTestObservabilitySession) {
117122
await launchTestSession(bsConfig, bsConfigPath);
118123
utils.setO11yProcessHooks(null, bsConfig, args, null, buildReportData);
@@ -314,6 +319,7 @@ module.exports = function run(args, rawArgs) {
314319
markBlockEnd('createBuild');
315320
markBlockEnd('total');
316321
utils.setProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData);
322+
console.log(`checking if testObservability session is enabled line 322: ${isTestObservabilitySession}`);
317323
if(isTestObservabilitySession) {
318324
utils.setO11yProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData);
319325
}
@@ -524,6 +530,7 @@ module.exports = function run(args, rawArgs) {
524530
}).catch(function (err) {
525531
logger.error(err);
526532
utils.setUsageReportingFlag(null, args.disableUsageReporting);
533+
console.log(`now reading using readBsConfigJSON in catch block for validateBstackJson`);
527534
let bsJsonData = utils.readBsConfigJSON(bsConfigPath);
528535
utils.sendUsageReport(bsJsonData, args, err.message, Constants.messageTypes.ERROR, utils.getErrorCodeFromErr(err), null, rawArgs);
529536
process.exitCode = Constants.ERROR_EXIT_CODE;

bin/helpers/helper.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ const { readCypressConfigFile } = require('./readCypressConfigUtil');
1919
const { MAX_GIT_META_DATA_SIZE_IN_BYTES, GIT_META_DATA_TRUNCATED } = require('./constants')
2020
const CrashReporter = require('../testObservability/crashReporter');
2121
const HttpsProxyAgent = require('https-proxy-agent');
22+
const { TEST_REPORTING_ANALYTICS } = require("../testObservability/helper/constants");
2223

2324
exports.debug = (text, shouldReport = false, throwable = null) => {
25+
console.log(`checking if BROWSERSTACK_OBSERVABILITY_DEBUG is enabled: ${process.env.BROWSERSTACK_OBSERVABILITY_DEBUG}`);
2426
if (process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "true" || process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "1") {
25-
logger.info(`[ OBSERVABILITY ] ${text}`);
27+
logger.info(`[ ${TEST_REPORTING_ANALYTICS} ] ${text}`);
2628
}
2729
if(shouldReport) {
2830
CrashReporter.getInstance().uploadCrashReport(text, throwable ? throwable && throwable.stack : null);
@@ -290,6 +292,8 @@ exports.getBuildDetails = (bsConfig, isO11y = false) => {
290292
projectName = process.env.BROWSERSTACK_PROJECT_NAME || projectName;
291293

292294
/* Pick from testObservabilityOptions */
295+
console.log(`isTestObservabilityOptionsPresent: ${isTestObservabilityOptionsPresent}`);
296+
console.log(`bsConfig in getBuildDetails: ${JSON.stringify(bsConfig, null, 2)}`);
293297
if(isTestObservabilityOptionsPresent) {
294298
buildName = buildName || bsConfig["testObservabilityOptions"]["buildName"];
295299
projectName = projectName || bsConfig["testObservabilityOptions"]["projectName"];

bin/helpers/utils.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ exports.validateBstackJson = (bsConfigPath) => {
3333
try {
3434
logger.info(`Reading config from ${bsConfigPath}`);
3535
let bsConfig = require(bsConfigPath);
36+
bsConfig = exports.normalizeTestReportingConfig(bsConfig);
37+
console.log(`BrowserStack config loaded after normalizing: ${JSON.stringify(bsConfig, null, 2)}`);
3638
resolve(bsConfig);
3739
} catch (e) {
3840
reject(
@@ -492,7 +494,7 @@ exports.setNodeVersion = (bsConfig, args) => {
492494
// specs can be passed via command line args as a string
493495
// command line args takes precedence over config
494496
exports.setUserSpecs = (bsConfig, args) => {
495-
497+
console.log(`checking if testObservability session is enabled setUserSpecs line 497: ${o11yHelpers.isTestObservabilitySession()}`);
496498
if(o11yHelpers.isBrowserstackInfra() && o11yHelpers.isTestObservabilitySession() && o11yHelpers.shouldReRunObservabilityTests()) {
497499
bsConfig.run_settings.specs = process.env.BROWSERSTACK_RERUN_TESTS;
498500
return;
@@ -1236,6 +1238,7 @@ exports.handleSyncExit = (exitCode, dashboard_url) => {
12361238
syncCliLogger.info(Constants.userMessages.BUILD_REPORT_MESSAGE);
12371239
syncCliLogger.info(dashboard_url);
12381240
}
1241+
console.log(`checking if observability session is active from handleSyncExit ${o11yHelpers.isTestObservabilitySession()}`);
12391242
if(o11yHelpers.isTestObservabilitySession()) {
12401243
o11yHelpers.printBuildLink(true, exitCode);
12411244
} else {
@@ -1499,7 +1502,7 @@ exports.splitStringByCharButIgnoreIfWithinARange = (str, splitChar, leftLimiter,
14991502

15001503
// blindly send other passed configs with run_settings and handle at backend
15011504
exports.setOtherConfigs = (bsConfig, args) => {
1502-
1505+
console.log(`checking if observability session is active from setOtherConfigs ${o11yHelpers.isTestObservabilitySession()}`);
15031506
if(o11yHelpers.isTestObservabilitySession() && process.env.BS_TESTOPS_JWT) {
15041507
bsConfig["run_settings"]["reporter"] = TEST_OBSERVABILITY_REPORTER;
15051508
return;
@@ -1519,7 +1522,17 @@ exports.setOtherConfigs = (bsConfig, args) => {
15191522
exports.readBsConfigJSON = (bsConfigPath) => {
15201523
try {
15211524
fs.accessSync(bsConfigPath, fs.constants.R_OK);
1522-
return fs.readFileSync(bsConfigPath, 'utf-8');
1525+
const configContent = fs.readFileSync(bsConfigPath, 'utf-8');
1526+
console.log(`configContent: ${configContent}`);
1527+
try {
1528+
const bsConfig = JSON.parse(configContent);
1529+
const normalizedBsConfig = exports.normalizeTestReportingConfig(bsConfig);
1530+
console.log(`normalizedBsConfig: ${JSON.stringify(normalizedBsConfig)}`);
1531+
return JSON.stringify(normalizedBsConfig);
1532+
} catch (err) {
1533+
logger.error(`Error parsing JSON from ${bsConfigPath}:`, err);
1534+
return configContent;
1535+
}
15231536
} catch (err) {
15241537
return null;
15251538
}
@@ -1804,3 +1817,25 @@ exports.decodeJWTToken = (token) => {
18041817
return undefined;
18051818
}
18061819
}
1820+
1821+
exports.normalizeTestReportingEnvVars = () => {
1822+
if (!this.isUndefined(process.env.BROWSERSTACK_TEST_REPORTING)){
1823+
process.env.BROWSERSTACK_TEST_OBSERVABILITY = process.env.BROWSERSTACK_TEST_REPORTING;
1824+
}
1825+
1826+
if (!this.isUndefined(process.env.BROWSERSTACK_TEST_REPORTING_DEBUG)){
1827+
process.env.BROWSERSTACK_OBSERVABILITY_DEBUG = process.env.BROWSERSTACK_TEST_REPORTING_DEBUG;
1828+
}
1829+
}
1830+
1831+
exports.normalizeTestReportingConfig = (bsConfig) => {
1832+
if (!this.isUndefined(bsConfig["testReporting"])) {
1833+
bsConfig["testObservability"] = bsConfig["testReporting"];
1834+
}
1835+
1836+
if (!this.isUndefined(bsConfig["testReportingOptions"])) {
1837+
bsConfig["testObservabilityOptions"] = bsConfig["testReportingOptions"];
1838+
}
1839+
1840+
return bsConfig;
1841+
}

bin/testObservability/crashReporter/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const HttpsProxyAgent = require('https-proxy-agent');
77
const logger = require("../../helpers/logger").winstonLogger;
88
const utils = require('../../helpers/utils');
99

10-
const { API_URL, consoleHolder } = require('../helper/constants');
10+
const { API_URL, consoleHolder, TEST_REPORTING_ANALYTICS } = require('../helper/constants');
1111

1212
/* Below global methods are added here to remove cyclic dependency with helper.js, refactor later */
1313
const httpsKeepAliveAgent = new https.Agent({
@@ -18,8 +18,9 @@ const httpsKeepAliveAgent = new https.Agent({
1818
});
1919

2020
const debug = (text) => {
21+
console.log(`checking if BROWSERSTACK_OBSERVABILITY_DEBUG is enabled: ${process.env.BROWSERSTACK_OBSERVABILITY_DEBUG}`);
2122
if (process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "true" || process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "1") {
22-
logger.info(`[ OBSERVABILITY ] ${text}`);
23+
logger.info(`[ ${TEST_REPORTING_ANALYTICS} ] ${text}`);
2324
}
2425
}
2526

bin/testObservability/helper/constants.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ exports.IPC_EVENTS = {
1616

1717
exports.OBSERVABILITY_ENV_VARS = [
1818
"BROWSERSTACK_TEST_OBSERVABILITY",
19+
"BROWSERSTACK_TEST_REPORTING",
1920
"BROWSERSTACK_AUTOMATION",
2021
"BS_TESTOPS_BUILD_COMPLETED",
2122
"BS_TESTOPS_JWT",
2223
"BS_TESTOPS_BUILD_HASHED_ID",
2324
"BS_TESTOPS_ALLOW_SCREENSHOTS",
2425
"OBSERVABILITY_LAUNCH_SDK_VERSION",
2526
"BROWSERSTACK_OBSERVABILITY_DEBUG",
27+
"BROWSERSTACK_TEST_REPORTING_DEBUG",
2628
"OBS_CRASH_REPORTING_USERNAME",
2729
"OBS_CRASH_REPORTING_ACCESS_KEY",
2830
"OBS_CRASH_REPORTING_BS_CONFIG_PATH",
@@ -34,3 +36,5 @@ exports.TEST_OBSERVABILITY_REPORTER = 'browserstack-cypress-cli/bin/testObservab
3436
exports.TEST_OBSERVABILITY_REPORTER_LOCAL = path.join(__dirname, '..', 'reporter');
3537

3638
exports.PENDING_QUEUES_FILE = `pending_queues_${process.pid}.json`;
39+
40+
exports.TEST_REPORTING_ANALYTICS = 'TEST REPORTING AND ANALYTICS';

bin/testObservability/helper/helper.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const GLOBAL_MODULE_PATH = execSync('npm root -g').toString().trim();
2727
const { name, version } = require('../../../package.json');
2828

2929
const { CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS } = require('../../helpers/constants');
30-
const { consoleHolder, API_URL, TEST_OBSERVABILITY_REPORTER, TEST_OBSERVABILITY_REPORTER_LOCAL } = require('./constants');
30+
const { consoleHolder, API_URL, TEST_OBSERVABILITY_REPORTER, TEST_OBSERVABILITY_REPORTER_LOCAL, TEST_REPORTING_ANALYTICS } = require('./constants');
3131

3232
const ALLOWED_MODULES = [
3333
'cypress/package.json',
@@ -41,15 +41,17 @@ exports.pending_test_uploads = {
4141
};
4242

4343
exports.debugOnConsole = (text) => {
44+
console.log(`checking if BROWSERSTACK_TEST_OBSERVABILITY_DEBUG is enabled in debugOnConsole: ${process.env.BROWSERSTACK_OBSERVABILITY_DEBUG}`);
4445
if ((process.env.BROWSERSTACK_OBSERVABILITY_DEBUG + '') === "true" ||
4546
(process.env.BROWSERSTACK_OBSERVABILITY_DEBUG + '') === "1") {
46-
consoleHolder.log(`[ OBSERVABILITY ] ${text}`);
47+
consoleHolder.log(`[ ${TEST_REPORTING_ANALYTICS} ] ${text}`);
4748
}
4849
}
4950

5051
exports.debug = (text, shouldReport = false, throwable = null) => {
52+
console.log(`checking if BROWSERSTACK_OBSERVABILITY_DEBUG is enabled in debug 52: ${process.env.BROWSERSTACK_OBSERVABILITY_DEBUG}`);
5153
if (process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "true" || process.env.BROWSERSTACK_OBSERVABILITY_DEBUG === "1") {
52-
logger.info(`[ OBSERVABILITY ] ${text}`);
54+
logger.info(`[ ${TEST_REPORTING_ANALYTICS} ] ${text}`);
5355
}
5456
if(shouldReport) {
5557
CrashReporter.getInstance().uploadCrashReport(text, throwable ? throwable && throwable.stack : null);
@@ -93,6 +95,7 @@ const supportFileCleanup = () => {
9395
exports.buildStopped = false;
9496

9597
exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
98+
console.log(`checking if testObservability session is active from printBuildLink ${this.isTestObservabilitySession()}`);
9699
if(!this.isTestObservabilitySession() || exports.buildStopped) return;
97100
exports.buildStopped = true;
98101
try {
@@ -326,6 +329,8 @@ const getCypressConfigFileContent = (bsConfig, cypressConfigPath) => {
326329
}
327330

328331
exports.setCrashReportingConfigFromReporter = (credentialsStr, bsConfigPath, cypressConfigPath) => {
332+
console.log(`Setting Crash Reporting Config with bsConfigPath: ${bsConfigPath}`);
333+
console.log(`Setting Crash Reporting Config with bsConfig: ${JSON.stringify(bsConfig)}`);
329334
try {
330335
const browserstackConfigFile = utils.readBsConfigJSON(bsConfigPath);
331336
const cypressConfigFile = getCypressConfigFileContent(null, cypressConfigPath);
@@ -513,15 +518,16 @@ exports.batchAndPostEvents = async (eventUrl, kind, data) => {
513518
} catch(error) {
514519
exports.debugOnConsole(`[Request Error] Error in sending request ${util.format(error)}`);
515520
if (error.response) {
516-
exports.debug(`EXCEPTION IN ${kind} REQUEST TO TEST OBSERVABILITY : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
521+
exports.debug(`EXCEPTION IN ${kind} REQUEST TO ${TEST_REPORTING_ANALYTICS} : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
517522
} else {
518-
exports.debug(`EXCEPTION IN ${kind} REQUEST TO TEST OBSERVABILITY : ${error.message || error}`, true, error);
523+
exports.debug(`EXCEPTION IN ${kind} REQUEST TO ${TEST_REPORTING_ANALYTICS} : ${error.message || error}`, true, error);
519524
}
520525
exports.pending_test_uploads.count = Math.max(0,exports.pending_test_uploads.count - data.length);
521526
}
522527
}
523528

524529
const RequestQueueHandler = require('./requestQueueHandler');
530+
const constants = require('../../helpers/constants');
525531
exports.requestQueueHandler = new RequestQueueHandler();
526532

527533
exports.uploadEventData = async (eventData, run=0) => {
@@ -541,7 +547,7 @@ exports.uploadEventData = async (eventData, run=0) => {
541547

542548
if (process.env.BS_TESTOPS_BUILD_COMPLETED === "true") {
543549
if(process.env.BS_TESTOPS_JWT == "null") {
544-
exports.debug(`EXCEPTION IN ${log_tag} REQUEST TO TEST OBSERVABILITY : missing authentication token`);
550+
exports.debug(`EXCEPTION IN ${log_tag} REQUEST TO ${TEST_REPORTING_ANALYTICS}: missing authentication token`);
545551
exports.pending_test_uploads.count = Math.max(0,exports.pending_test_uploads.count-1);
546552
return {
547553
status: 'error',
@@ -586,9 +592,9 @@ exports.uploadEventData = async (eventData, run=0) => {
586592
} catch(error) {
587593
exports.debugOnConsole(`[Request Error] Error in sending request ${util.format(error)}`);
588594
if (error.response) {
589-
exports.debug(`EXCEPTION IN ${event_api_url !== exports.requestQueueHandler.eventUrl ? log_tag : 'Batch-Queue'} REQUEST TO TEST OBSERVABILITY : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
595+
exports.debug(`EXCEPTION IN ${event_api_url !== exports.requestQueueHandler.eventUrl ? log_tag : 'Batch-Queue'} REQUEST TO ${TEST_REPORTING_ANALYTICS} : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
590596
} else {
591-
exports.debug(`EXCEPTION IN ${event_api_url !== exports.requestQueueHandler.eventUrl ? log_tag : 'Batch-Queue'} REQUEST TO TEST OBSERVABILITY : ${error.message || error}`, true, error);
597+
exports.debug(`EXCEPTION IN ${event_api_url !== exports.requestQueueHandler.eventUrl ? log_tag : 'Batch-Queue'} REQUEST TO ${TEST_REPORTING_ANALYTICS} : ${error.message || error}`, true, error);
592598
}
593599
exports.pending_test_uploads.count = Math.max(0,exports.pending_test_uploads.count - (event_api_url === 'api/v1/event' ? 1 : data.length));
594600
return {
@@ -598,7 +604,7 @@ exports.uploadEventData = async (eventData, run=0) => {
598604
}
599605
}
600606
} else if (run >= 5) {
601-
exports.debug(`EXCEPTION IN ${log_tag} REQUEST TO TEST OBSERVABILITY : Build Start is not completed and ${log_tag} retry runs exceeded`);
607+
exports.debug(`EXCEPTION IN ${log_tag} REQUEST TO ${TEST_REPORTING_ANALYTICS} : Build Start is not completed and ${log_tag} retry runs exceeded`);
602608
if(process.env.BS_TESTOPS_JWT != "null") exports.pending_test_uploads.count = Math.max(0,exports.pending_test_uploads.count-1);
603609
return {
604610
status: 'error',
@@ -621,6 +627,9 @@ exports.setTestObservabilityFlags = (bsConfig) => {
621627
/* set default again but under try catch in case of wrong config */
622628
isTestObservabilitySession = utils.nonEmptyArray(bsConfig.run_settings.downloads) ? false : true;
623629

630+
console.log(`bsconfig from setTestObservabilityFlags: ${JSON.stringify(bsConfig)}`);
631+
console.log(`bs test olly enabled from env: ${process.env.BROWSERSTACK_TEST_OBSERVABILITY}`);
632+
624633
if(!utils.isUndefined(bsConfig["testObservability"])) isTestObservabilitySession = ( bsConfig["testObservability"] == true || bsConfig["testObservability"] == 1 );
625634
if(!utils.isUndefined(process.env.BROWSERSTACK_TEST_OBSERVABILITY)) isTestObservabilitySession = ( process.env.BROWSERSTACK_TEST_OBSERVABILITY == "true" || process.env.BROWSERSTACK_TEST_OBSERVABILITY == "1" );
626635
if(process.argv.includes('--disable-test-observability')) isTestObservabilitySession = false;
@@ -646,6 +655,7 @@ exports.setTestObservabilityFlags = (bsConfig) => {
646655
process.env.BROWSERSTACK_TEST_OBSERVABILITY = isTestObservabilitySession;
647656
process.env.BROWSERSTACK_AUTOMATION = isBrowserstackInfra;
648657

658+
console.log(`final testObservability capability is set to in setTestPObservabilityFlag ${isTestObservabilitySession}`);
649659
return [isTestObservabilitySession, isBrowserstackInfra];
650660
}
651661

@@ -664,7 +674,7 @@ exports.shouldReRunObservabilityTests = () => {
664674
exports.stopBuildUpstream = async () => {
665675
if (process.env.BS_TESTOPS_BUILD_COMPLETED === "true") {
666676
if(process.env.BS_TESTOPS_JWT == "null" || process.env.BS_TESTOPS_BUILD_HASHED_ID == "null") {
667-
exports.debug('EXCEPTION IN stopBuildUpstream REQUEST TO TEST OBSERVABILITY : Missing authentication token');
677+
exports.debug(`EXCEPTION IN stopBuildUpstream REQUEST TO ${TEST_REPORTING_ANALYTICS} : Missing authentication token`);
668678
return {
669679
status: 'error',
670680
message: 'Token/buildID is undefined, build creation might have failed'
@@ -694,9 +704,9 @@ exports.stopBuildUpstream = async () => {
694704
}
695705
} catch(error) {
696706
if (error.response) {
697-
exports.debug(`EXCEPTION IN stopBuildUpstream REQUEST TO TEST OBSERVABILITY : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
707+
exports.debug(`EXCEPTION IN stopBuildUpstream REQUEST TO ${TEST_REPORTING_ANALYTICS} : ${error.response.status} ${error.response.statusText} ${JSON.stringify(error.response.data)}`, true, error);
698708
} else {
699-
exports.debug(`EXCEPTION IN stopBuildUpstream REQUEST TO TEST OBSERVABILITY : ${error.message || error}`, true, error);
709+
exports.debug(`EXCEPTION IN stopBuildUpstream REQUEST TO ${TEST_REPORTING_ANALYTICS} : ${error.message || error}`, true, error);
700710
}
701711
return {
702712
status: 'error',
@@ -852,6 +862,7 @@ exports.resolveModule = (module) => {
852862

853863
const getReRunSpecs = (rawArgs) => {
854864
let finalArgs = rawArgs;
865+
console.log(`checking if testObservability is enabled in getRerun specs ${this.isTestObservabilitySession()}`);
855866
if (this.isTestObservabilitySession() && this.shouldReRunObservabilityTests()) {
856867
let startIdx = -1, numEle = 0;
857868
for(let idx=0; idx<rawArgs.length; idx++) {
@@ -870,6 +881,7 @@ const getReRunSpecs = (rawArgs) => {
870881
}
871882

872883
const getLocalSessionReporter = () => {
884+
console.log(`checking if testObservability is enabled getLocalSessionReporter ${this.isTestObservabilitySession()}`);
873885
if(this.isTestObservabilitySession() && process.env.BS_TESTOPS_JWT) {
874886
return ['--reporter', TEST_OBSERVABILITY_REPORTER_LOCAL];
875887
} else {

bin/testObservability/reporter/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Mocha = requireModule('mocha');
1212
const Runnable = require('mocha/lib/runnable'); // need to handle as this isn't present in older mocha versions
1313
const { v4: uuidv4 } = require('uuid');
1414

15-
const { IPC_EVENTS } = require('../helper/constants');
15+
const { IPC_EVENTS, TEST_REPORTING_ANALYTICS } = require('../helper/constants');
1616
const { startIPCServer } = require('../plugin/ipcServer');
1717

1818
const HOOK_TYPES_MAP = {
@@ -88,6 +88,7 @@ class MyReporter {
8888
})
8989

9090
.on(EVENT_HOOK_BEGIN, async (hook) => {
91+
console.log(`checking testObservability is enabled in hook begin ${this.testObservability}`);
9192
debugOnConsole(`[MOCHA EVENT] EVENT_HOOK_BEGIN`);
9293
if(this.testObservability == true) {
9394
if(!hook.hookAnalyticsId) {
@@ -511,7 +512,7 @@ class MyReporter {
511512
});
512513
}
513514
} catch(error) {
514-
debug(`Exception in uploading log data to Observability with error : ${error}`, true, error);
515+
debug(`Exception in uploading log data to ${TEST_REPORTING_ANALYTICS} with error : ${error}`, true, error);
515516
}
516517
}
517518

0 commit comments

Comments
 (0)