browserstack-cypress-cli 1.36.10 → 1.36.12
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.
- package/.github/workflows/Semgrep.yml +1 -2
- package/bin/accessibility-automation/helper.js +136 -0
- package/bin/accessibility-automation/plugin/index.js +5 -0
- package/bin/commands/runs.js +17 -2
- package/bin/helpers/config.js +3 -0
- package/bin/helpers/constants.js +2 -0
- package/bin/helpers/readCypressConfigUtil.js +50 -2
- package/bin/helpers/requireModule.js +14 -0
- package/bin/helpers/utils.js +1 -1
- package/bin/testObservability/reporter/index.js +1 -0
- package/package.json +1 -1
|
@@ -27,8 +27,7 @@ jobs:
|
|
|
27
27
|
|
|
28
28
|
container:
|
|
29
29
|
# A Docker image with Semgrep installed. Do not change this.
|
|
30
|
-
image: returntocorp/semgrep
|
|
31
|
-
|
|
30
|
+
image: returntocorp/semgrep:1.166.0
|
|
32
31
|
# Skip any PR created by dependabot to avoid permission issues:
|
|
33
32
|
if: (github.actor != 'dependabot[bot]')
|
|
34
33
|
|
|
@@ -41,6 +41,142 @@ exports.isAccessibilitySupportedCypressVersion = (cypress_config_filename) => {
|
|
|
41
41
|
return CYPRESS_V10_AND_ABOVE_CONFIG_FILE_EXTENSIONS.includes(extension);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// Token identifying the accessibility plugin module path in source.
|
|
45
|
+
const ACCESSIBILITY_PLUGIN_PATH_TOKEN = 'accessibility-automation/plugin';
|
|
46
|
+
|
|
47
|
+
// Strip JS/TS comments so that commented-out plugin imports/calls are ignored
|
|
48
|
+
// by the static scans below.
|
|
49
|
+
//
|
|
50
|
+
// NOTE: this is an intentionally best-effort / lossy scrubber, NOT a real parser.
|
|
51
|
+
// It can also strip `//` or `/* */` sequences that appear inside string literals,
|
|
52
|
+
// and the `[^:]` guard only avoids `://` (URLs). This is acceptable because these
|
|
53
|
+
// static scans are a secondary signal: the authoritative "is the plugin imported"
|
|
54
|
+
// check is the require-load marker (BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED), so a
|
|
55
|
+
// mis-stripped string literal cannot cause a false import detection.
|
|
56
|
+
const stripComments = (src) => {
|
|
57
|
+
return src
|
|
58
|
+
.replace(/\/\*[\s\S]*?\*\//g, ' ') // block comments
|
|
59
|
+
.replace(/(^|[^:])\/\/[^\n]*/g, '$1'); // line comments (skip URLs like http://)
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// Reads the cypress config source (comments stripped). Returns null if it cannot
|
|
63
|
+
// be read.
|
|
64
|
+
const readConfigSource = (user_config) => {
|
|
65
|
+
const configPath = user_config.run_settings && user_config.run_settings.cypressConfigFilePath;
|
|
66
|
+
if (!configPath || !fs.existsSync(configPath)) return null;
|
|
67
|
+
return stripComments(fs.readFileSync(configPath, { encoding: 'utf-8' }));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Finds the symbol the accessibility plugin is imported as, via require() or
|
|
71
|
+
// import, regardless of path style. Handles `require()`, default `import X from`,
|
|
72
|
+
// and namespace `import * as X from`. Returns the binding name or null. Named
|
|
73
|
+
// (`import { X }`) and dynamic (`await import(...)`) forms are not parsed here —
|
|
74
|
+
// the strict fallback biases toward keeping accessibility on for those (see
|
|
75
|
+
// isAccessibilityPluginImportedAndCalledInSource).
|
|
76
|
+
const getAccessibilityPluginBinding = (content) => {
|
|
77
|
+
const requireMatch = content.match(/(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*=\s*require\(\s*['"][^'"]*accessibility-automation\/plugin['"]\s*\)/);
|
|
78
|
+
const importNamespaceMatch = content.match(/import\s+\*\s+as\s+([A-Za-z0-9_$]+)\s+from\s+['"][^'"]*accessibility-automation\/plugin['"]/);
|
|
79
|
+
const importDefaultMatch = content.match(/import\s+([A-Za-z0-9_$]+)\s+from\s+['"][^'"]*accessibility-automation\/plugin['"]/);
|
|
80
|
+
return (requireMatch && requireMatch[1]) ||
|
|
81
|
+
(importNamespaceMatch && importNamespaceMatch[1]) ||
|
|
82
|
+
(importDefaultMatch && importDefaultMatch[1]) ||
|
|
83
|
+
null;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const isBindingCalled = (content, binding) => {
|
|
87
|
+
const callRegex = new RegExp('\\b' + binding.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '\\s*\\(');
|
|
88
|
+
return callRegex.test(content);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Static check: confirm the (already-imported) accessibility plugin is actually
|
|
92
|
+
// invoked in the config source. Lenient — if the import binding cannot be located
|
|
93
|
+
// via static parsing (unusual syntax) or the source cannot be read, we do NOT
|
|
94
|
+
// veto the require-based detection (return true), to avoid wrongly disabling
|
|
95
|
+
// valid configs.
|
|
96
|
+
const isAccessibilityPluginInvokedInSource = (user_config) => {
|
|
97
|
+
try {
|
|
98
|
+
const content = readConfigSource(user_config);
|
|
99
|
+
if (content === null) return true;
|
|
100
|
+
const binding = getAccessibilityPluginBinding(content);
|
|
101
|
+
if (!binding) return true;
|
|
102
|
+
return isBindingCalled(content, binding);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
logger.debug(`Unable to verify accessibility plugin invocation: ${error.message || error}`);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Pure static fallback: used only when the config could not be required (e.g. a
|
|
110
|
+
// TypeScript config before BrowserStack packages are installed), so such users
|
|
111
|
+
// are still evaluated. Biased toward KEEPING accessibility enabled: if the plugin
|
|
112
|
+
// path is present but we cannot confidently parse the import binding (e.g. named
|
|
113
|
+
// `import { X }` or dynamic `await import(...)`), we do not disable — silently
|
|
114
|
+
// turning off a billed feature based on a lossy source scan is worse than leaving
|
|
115
|
+
// it on. We only return false when there is positive evidence the plugin is not
|
|
116
|
+
// wired in (path absent, or binding parsed and demonstrably never called).
|
|
117
|
+
const isAccessibilityPluginImportedAndCalledInSource = (user_config) => {
|
|
118
|
+
try {
|
|
119
|
+
const content = readConfigSource(user_config);
|
|
120
|
+
if (content === null) return false;
|
|
121
|
+
// Plugin path not referenced at all -> definitely not imported.
|
|
122
|
+
if (!content.includes(ACCESSIBILITY_PLUGIN_PATH_TOKEN)) return false;
|
|
123
|
+
const binding = getAccessibilityPluginBinding(content);
|
|
124
|
+
// Path present but binding not parseable (namespace/named/dynamic import) ->
|
|
125
|
+
// keep accessibility on rather than risk a false disable.
|
|
126
|
+
if (!binding) return true;
|
|
127
|
+
// Binding parsed: trust the precise call check (catches import-without-call).
|
|
128
|
+
return isBindingCalled(content, binding);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
logger.debug(`Unable to scan cypress config for accessibility plugin: ${error.message || error}`);
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Determines whether the BrowserStack accessibility plugin is genuinely wired
|
|
137
|
+
* into the user's cypress config, i.e. both imported AND invoked.
|
|
138
|
+
*
|
|
139
|
+
* Detection combines two signals:
|
|
140
|
+
* 1) Require-load: reading the cypress config executes its top-level requires;
|
|
141
|
+
* the plugin sets BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED on load, which
|
|
142
|
+
* readCypressConfigFile propagates back as a definitive 'true'/'false'. This
|
|
143
|
+
* tells us whether the plugin is imported (and does not false-positive on a
|
|
144
|
+
* commented-out require, since commented code never executes).
|
|
145
|
+
* 2) Static source scan: confirms the imported plugin binding is actually called
|
|
146
|
+
* in the config — so "imported but never called" is treated as not loaded.
|
|
147
|
+
*
|
|
148
|
+
* If the config could not be required (env var stays undefined, e.g. a TS config
|
|
149
|
+
* before packages are installed), we fall back to a pure static scan that checks
|
|
150
|
+
* for both import and invocation.
|
|
151
|
+
*/
|
|
152
|
+
exports.isAccessibilityPluginLoaded = (user_config) => {
|
|
153
|
+
try {
|
|
154
|
+
// Reset before reading so a stale value from a previous run cannot leak in.
|
|
155
|
+
delete process.env.BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED;
|
|
156
|
+
const { readCypressConfigFile } = require('../helpers/readCypressConfigUtil');
|
|
157
|
+
readCypressConfigFile(user_config);
|
|
158
|
+
|
|
159
|
+
const detection = process.env.BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED;
|
|
160
|
+
if (detection === 'true') {
|
|
161
|
+
// Imported via require — additionally require that it is actually invoked.
|
|
162
|
+
const called = isAccessibilityPluginInvokedInSource(user_config);
|
|
163
|
+
if (!called) {
|
|
164
|
+
logger.debug('Accessibility plugin is imported but not invoked in the cypress config; treating as not loaded.');
|
|
165
|
+
}
|
|
166
|
+
return called;
|
|
167
|
+
}
|
|
168
|
+
if (detection === 'false') return false;
|
|
169
|
+
|
|
170
|
+
// Inconclusive (config could not be required) — fall back to a static scan
|
|
171
|
+
// that checks for both import and invocation.
|
|
172
|
+
logger.debug('Accessibility plugin detection inconclusive from config require; falling back to source scan.');
|
|
173
|
+
return isAccessibilityPluginImportedAndCalledInSource(user_config);
|
|
174
|
+
} catch (error) {
|
|
175
|
+
logger.debug(`Unable to determine if accessibility plugin is loaded: ${error.message || error}`);
|
|
176
|
+
return isAccessibilityPluginImportedAndCalledInSource(user_config);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
44
180
|
exports.createAccessibilityTestRun = async (user_config, framework) => {
|
|
45
181
|
|
|
46
182
|
try {
|
|
@@ -3,7 +3,12 @@ const { decodeJWTToken } = require("../../helpers/utils");
|
|
|
3
3
|
const utils = require('../../helpers/utils');
|
|
4
4
|
const http = require('http');
|
|
5
5
|
|
|
6
|
+
process.env.BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED = 'true';
|
|
7
|
+
|
|
6
8
|
const browserstackAccessibility = (on, config) => {
|
|
9
|
+
// Also set on invocation, so that a runtime read of the plugin reflects that
|
|
10
|
+
// it was actually called within setupNodeEvents.
|
|
11
|
+
process.env.BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED = 'true';
|
|
7
12
|
let browser_validation = true;
|
|
8
13
|
if (process.env.BROWSERSTACK_ACCESSIBILITY_DEBUG === 'true') {
|
|
9
14
|
config.env.BROWSERSTACK_LOGS = 'true';
|
package/bin/commands/runs.js
CHANGED
|
@@ -30,10 +30,11 @@ const {
|
|
|
30
30
|
printBuildLink
|
|
31
31
|
} = require('../testObservability/helper/helper');
|
|
32
32
|
|
|
33
|
-
const {
|
|
33
|
+
const {
|
|
34
34
|
createAccessibilityTestRun,
|
|
35
35
|
setAccessibilityEventListeners,
|
|
36
36
|
checkAccessibilityPlatform,
|
|
37
|
+
isAccessibilityPluginLoaded,
|
|
37
38
|
supportFileCleanup
|
|
38
39
|
} = require('../accessibility-automation/helper');
|
|
39
40
|
const { isTurboScaleSession, getTurboScaleGridDetails, patchCypressConfigFileContent, atsFileCleanup } = require('../helpers/atsHelper');
|
|
@@ -42,6 +43,10 @@ const TestHubHandler = require('../testhub/testhubHandler');
|
|
|
42
43
|
|
|
43
44
|
module.exports = function run(args, rawArgs) {
|
|
44
45
|
utils.normalizeTestReportingEnvVars();
|
|
46
|
+
// Tracks the case where accessibility was requested but the plugin is not
|
|
47
|
+
// wired into the cypress config; surfaced in the end-of-session EDS event so
|
|
48
|
+
// such builds can be excluded from accessibility stability queries.
|
|
49
|
+
let accessibilityPluginNotLoaded = false;
|
|
45
50
|
markBlockStart('preBuild');
|
|
46
51
|
// set debug mode (--cli-debug)
|
|
47
52
|
utils.setDebugMode(args);
|
|
@@ -69,7 +74,7 @@ module.exports = function run(args, rawArgs) {
|
|
|
69
74
|
/* Set testObservability & browserstackAutomation flags */
|
|
70
75
|
const [isTestObservabilitySession, isBrowserstackInfra] = setTestObservabilityFlags(bsConfig);
|
|
71
76
|
const checkAccessibility = checkAccessibilityPlatform(bsConfig);
|
|
72
|
-
|
|
77
|
+
let isAccessibilitySession = bsConfig.run_settings.accessibility || checkAccessibility;
|
|
73
78
|
const turboScaleSession = isTurboScaleSession(bsConfig);
|
|
74
79
|
Constants.turboScaleObj.enabled = turboScaleSession;
|
|
75
80
|
|
|
@@ -113,6 +118,15 @@ module.exports = function run(args, rawArgs) {
|
|
|
113
118
|
// set build tag caps
|
|
114
119
|
utils.setBuildTags(bsConfig, args);
|
|
115
120
|
|
|
121
|
+
// If accessibility is requested but the BrowserStack accessibility plugin is
|
|
122
|
+
// not loaded in the cypress config, explicitly disable accessibility before
|
|
123
|
+
// the build start event so the build is not treated as an accessibility build.
|
|
124
|
+
if (isAccessibilitySession && isBrowserstackInfra && !isAccessibilityPluginLoaded(bsConfig)) {
|
|
125
|
+
logger.warn(Constants.userMessages.ACCESSIBILITY_PLUGIN_NOT_LOADED);
|
|
126
|
+
accessibilityPluginNotLoaded = true;
|
|
127
|
+
isAccessibilitySession = false;
|
|
128
|
+
}
|
|
129
|
+
|
|
116
130
|
checkAndSetAccessibility(bsConfig, isAccessibilitySession);
|
|
117
131
|
|
|
118
132
|
const preferredPort = 5348;
|
|
@@ -422,6 +436,7 @@ module.exports = function run(args, rawArgs) {
|
|
|
422
436
|
unique_id: utils.generateUniqueHash(),
|
|
423
437
|
package_error: utils.checkError(packageData),
|
|
424
438
|
checkmd5_error: utils.checkError(md5data),
|
|
439
|
+
accessibility_plugin_not_loaded: accessibilityPluginNotLoaded,
|
|
425
440
|
build_id: data.build_id,
|
|
426
441
|
test_zip_size: test_zip_size,
|
|
427
442
|
npm_zip_size: npm_zip_size,
|
package/bin/helpers/config.js
CHANGED
|
@@ -26,6 +26,9 @@ config.retries = 5;
|
|
|
26
26
|
config.networkErrorExitCode = 2;
|
|
27
27
|
config.compiledConfigJsDirName = 'tmpBstackCompiledJs';
|
|
28
28
|
config.configJsonFileName = 'tmpCypressConfig.json';
|
|
29
|
+
// Temp file used to surface, from the child process that requires the cypress
|
|
30
|
+
// config, whether the BrowserStack accessibility plugin was loaded by it.
|
|
31
|
+
config.accessibilityPluginFlagFileName = 'tmpA11yPluginLoaded.json';
|
|
29
32
|
|
|
30
33
|
// turboScale
|
|
31
34
|
config.turboScaleMd5Sum = `${config.turboScaleUrl}/md5sumcheck`;
|
package/bin/helpers/constants.js
CHANGED
|
@@ -19,6 +19,8 @@ const syncCLI = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const userMessages = {
|
|
22
|
+
ACCESSIBILITY_PLUGIN_NOT_LOADED:
|
|
23
|
+
"BrowserStack Accessibility Automation plugin is not loaded in your cypress config file. Disabling accessibility for this build. Please follow https://www.browserstack.com/docs/accessibility/automated-tests/get-started/cypress to enable accessibility testing.",
|
|
22
24
|
BUILD_FAILED: "Build creation failed.",
|
|
23
25
|
BUILD_GENERATE_REPORT_FAILED:
|
|
24
26
|
"Generating report for the build <build-id> failed.",
|
|
@@ -8,6 +8,8 @@ const constants = require("./constants");
|
|
|
8
8
|
const utils = require("./utils");
|
|
9
9
|
const logger = require('./logger').winstonLogger;
|
|
10
10
|
|
|
11
|
+
const parsedCypressConfigCache = new Map();
|
|
12
|
+
|
|
11
13
|
// Defense-in-depth: reject file paths containing shell metacharacters.
|
|
12
14
|
// This guards against command injection even if execFileSync is ever
|
|
13
15
|
// replaced with a shell-based exec in the future.
|
|
@@ -226,6 +228,14 @@ exports.loadJsFile = (cypress_config_filepath, bstack_node_modules_path) => {
|
|
|
226
228
|
};
|
|
227
229
|
const args = [require_module_helper_path, cypress_config_filepath];
|
|
228
230
|
|
|
231
|
+
// Remove any stale detection flag from a crashed prior run so we never read an
|
|
232
|
+
// outdated value if the child fails to write a fresh one.
|
|
233
|
+
if (fs.existsSync(config.accessibilityPluginFlagFileName)) {
|
|
234
|
+
try {
|
|
235
|
+
fs.unlinkSync(config.accessibilityPluginFlagFileName)
|
|
236
|
+
} catch (e) { /* best-effort */ }
|
|
237
|
+
}
|
|
238
|
+
|
|
229
239
|
logger.debug(`Running: node ${args.map(a => '"' + a + '"').join(' ')} (via execFileSync, NODE_PATH=${bstack_node_modules_path})`);
|
|
230
240
|
cp.execFileSync('node', args, execOptions);
|
|
231
241
|
|
|
@@ -233,11 +243,33 @@ exports.loadJsFile = (cypress_config_filepath, bstack_node_modules_path) => {
|
|
|
233
243
|
if (fs.existsSync(config.configJsonFileName)) {
|
|
234
244
|
fs.unlinkSync(config.configJsonFileName)
|
|
235
245
|
}
|
|
246
|
+
|
|
247
|
+
// Propagate accessibility-plugin detection (written by requireModule.js in the
|
|
248
|
+
// child process) back into the parent process via an env var. We set it
|
|
249
|
+
// explicitly to 'true'/'false' only when the config was actually required, so
|
|
250
|
+
// callers can distinguish a definitive result from "could not read".
|
|
251
|
+
try {
|
|
252
|
+
if (fs.existsSync(config.accessibilityPluginFlagFileName)) {
|
|
253
|
+
const flag = JSON.parse(fs.readFileSync(config.accessibilityPluginFlagFileName).toString());
|
|
254
|
+
process.env.BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED = (flag && flag.accessibilityPluginLoaded) ? 'true' : 'false';
|
|
255
|
+
fs.unlinkSync(config.accessibilityPluginFlagFileName);
|
|
256
|
+
}
|
|
257
|
+
} catch (err) {
|
|
258
|
+
logger.debug(`Unable to read accessibility plugin detection flag: ${err.message}`);
|
|
259
|
+
}
|
|
260
|
+
|
|
236
261
|
return cypress_config
|
|
237
262
|
}
|
|
238
263
|
|
|
239
264
|
exports.readCypressConfigFile = (bsConfig) => {
|
|
240
265
|
const cypress_config_filepath = path.resolve(bsConfig.run_settings.cypressConfigFilePath)
|
|
266
|
+
|
|
267
|
+
// Return the memoized parse if this exact config was already read in this run.
|
|
268
|
+
if (parsedCypressConfigCache.has(cypress_config_filepath)) {
|
|
269
|
+
logger.debug(`Using memoized cypress config for: ${cypress_config_filepath}`);
|
|
270
|
+
return parsedCypressConfigCache.get(cypress_config_filepath);
|
|
271
|
+
}
|
|
272
|
+
|
|
241
273
|
try {
|
|
242
274
|
const cypress_config_filename = bsConfig.run_settings.cypress_config_filename
|
|
243
275
|
const bstack_node_modules_path = path.join(path.resolve(config.packageDirName), 'node_modules')
|
|
@@ -245,12 +277,19 @@ exports.readCypressConfigFile = (bsConfig) => {
|
|
|
245
277
|
|
|
246
278
|
logger.debug(`cypress config path: ${cypress_config_filepath}`);
|
|
247
279
|
|
|
280
|
+
let parsedConfig;
|
|
248
281
|
if (conf_lang == 'js' || conf_lang == 'cjs') {
|
|
249
|
-
|
|
282
|
+
parsedConfig = this.loadJsFile(cypress_config_filepath, bstack_node_modules_path)
|
|
250
283
|
} else if (conf_lang === 'ts') {
|
|
251
284
|
const compiled_cypress_config_filepath = this.convertTsConfig(bsConfig, cypress_config_filepath, bstack_node_modules_path)
|
|
252
|
-
|
|
285
|
+
parsedConfig = this.loadJsFile(compiled_cypress_config_filepath, bstack_node_modules_path)
|
|
253
286
|
}
|
|
287
|
+
|
|
288
|
+
// Cache only successful parses so a later call can retry on failure.
|
|
289
|
+
if (parsedConfig !== undefined) {
|
|
290
|
+
parsedCypressConfigCache.set(cypress_config_filepath, parsedConfig);
|
|
291
|
+
}
|
|
292
|
+
return parsedConfig;
|
|
254
293
|
} catch (error) {
|
|
255
294
|
const errorMessage = `Error while reading cypress config: ${error.message}`
|
|
256
295
|
const errorCode = 'cypress_config_file_read_failed'
|
|
@@ -270,5 +309,14 @@ exports.readCypressConfigFile = (bsConfig) => {
|
|
|
270
309
|
if (fs.existsSync(complied_js_dir)) {
|
|
271
310
|
fs.rmdirSync(complied_js_dir, { recursive: true })
|
|
272
311
|
}
|
|
312
|
+
// Guaranteed cleanup of the accessibility-plugin detection flag file, even
|
|
313
|
+
// if loadJsFile threw before its own read/unlink of the flag.
|
|
314
|
+
if (fs.existsSync(config.accessibilityPluginFlagFileName)) {
|
|
315
|
+
try {
|
|
316
|
+
fs.unlinkSync(config.accessibilityPluginFlagFileName)
|
|
317
|
+
} catch (cleanupErr) {
|
|
318
|
+
logger.debug(`Unable to remove accessibility plugin flag file: ${cleanupErr.message || cleanupErr}`);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
273
321
|
}
|
|
274
322
|
}
|
|
@@ -12,3 +12,17 @@ if (fs.existsSync(config.configJsonFileName)) {
|
|
|
12
12
|
|
|
13
13
|
// write module in temporary json file
|
|
14
14
|
fs.writeFileSync(config.configJsonFileName, JSON.stringify(mod))
|
|
15
|
+
|
|
16
|
+
// Requiring the cypress config above executes its top-level requires, which
|
|
17
|
+
// includes the BrowserStack accessibility plugin when the user has wired it in.
|
|
18
|
+
// The plugin sets BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED on load; surface that
|
|
19
|
+
// back to the parent CLI process via a temp flag file.
|
|
20
|
+
try {
|
|
21
|
+
const accessibilityPluginLoaded = process.env.BROWSERSTACK_ACCESSIBILITY_PLUGIN_LOADED === 'true';
|
|
22
|
+
fs.writeFileSync(
|
|
23
|
+
config.accessibilityPluginFlagFileName,
|
|
24
|
+
JSON.stringify({ accessibilityPluginLoaded })
|
|
25
|
+
);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
// best-effort: detection falls back to "not loaded" if this fails
|
|
28
|
+
}
|
package/bin/helpers/utils.js
CHANGED
|
@@ -889,7 +889,7 @@ exports.setLocalMode = (bsConfig, args) => {
|
|
|
889
889
|
if (localModeInferred && localModeUndefined) {
|
|
890
890
|
bsConfig.connection_settings.local_mode_inferred = local_mode;
|
|
891
891
|
}
|
|
892
|
-
logger.debug(`local_mode set to ${bsConfig.connection_settings.
|
|
892
|
+
logger.debug(`local_mode set to ${bsConfig.connection_settings.local_mode}`);
|
|
893
893
|
}
|
|
894
894
|
};
|
|
895
895
|
|