Skip to content

Commit 947bafc

Browse files
shirish87claude
andcommitted
fix(ci): pin Windows Node to 24.16.0; fix SonarQube issues
- Pin test-cli Windows matrix to Node.js 24.16.0 to avoid the native crash regression in v24.15.0 (STATUS_STACK_BUFFER_OVERRUN / exit 3221226505) on Windows Server 2025; macOS stays on lts/*. See: nodejs/node#62991 - Exclude **/generated/** and **/*.generated.ts from SonarQube scans in both CI workflow and test-sonar-local.sh; resolves false-positive "String literals should not be duplicated" and S4623 reports that originate entirely from code-generated files. - Fix SonarQube S2871: add localeCompare comparator to .sort() call in tui/pickers.ts that was sorting object entries without a compare fn. - Fix SonarQube S4623: change ensureAccessKeyExists/ensureUsernameExists parameter type from 'string | undefined' to optional '?: string' in utils.ts and browserstack-local.ts; remove the 13 explicit (undefined) call sites across all CLI entry-point files. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent de37f0b commit 947bafc

12 files changed

Lines changed: 28 additions & 20 deletions

‎.github/workflows/main.yml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
-Dsonar.sources=. \
135135
-Dsonar.tests=. \
136136
-Dsonar.test.inclusions="**/*.test.ts,**/*.spec.ts,**/*_test.go,**/__tests__/**,**/test/**" \
137-
-Dsonar.exclusions="**/node_modules/**,**/dist/**,**/dist-binary/**" \
137+
-Dsonar.exclusions="**/node_modules/**,**/dist/**,**/dist-binary/**,**/generated/**,**/*.generated.ts" \
138138
-Dsonar.host.url=http://localhost:9000 \
139139
-Dsonar.token=$SONAR_TOKEN
140140
@@ -255,6 +255,14 @@ jobs:
255255
strategy:
256256
matrix:
257257
os: [macos-latest, windows-2025]
258+
include:
259+
# Node.js v24.15.0 has a native crash regression on Windows Server 2025
260+
# (STATUS_STACK_BUFFER_OVERRUN / exit 3221226505) fixed in v24.16.0.
261+
# Pin Windows to 24.16.0; macOS stays on lts/*.
262+
- os: windows-2025
263+
node-version: "24.16.0"
264+
- os: macos-latest
265+
node-version: "lts/*"
258266
runs-on: ${{ matrix.os }}
259267
environment: BrowserStackEnv
260268
steps:
@@ -263,7 +271,7 @@ jobs:
263271

264272
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
265273
with:
266-
node-version: "lts/*"
274+
node-version: ${{ matrix.node-version }}
267275
cache: "pnpm"
268276

269277
- name: Install dependencies

‎packages/cli/typescript/src/browserstack-accessibility.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ export async function main(args: string[]): Promise<void> {
2626
};
2727

2828
try {
29-
const username = ensureUsernameExists(undefined);
30-
const accessKey = ensureAccessKeyExists(undefined);
29+
const username = ensureUsernameExists();
30+
const accessKey = ensureAccessKeyExists();
3131
const opts: ClientOptions = { username, accessKey };
3232

3333
const actionInput = args[0]?.toLowerCase();

‎packages/cli/typescript/src/browserstack-app-automate.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export async function main(
2727
logger: Logger = globalThis.console
2828
) {
2929
try {
30-
ensureAccessKeyExists(undefined);
31-
ensureUsernameExists(undefined);
30+
ensureAccessKeyExists();
31+
ensureUsernameExists();
3232

3333
const args = inputArgs.map((a) => a.trim());
3434
const actionInput = args[0]?.toLowerCase();

‎packages/cli/typescript/src/browserstack-automate.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ export async function main(
8181
logger: Logger = globalThis.console
8282
) {
8383
try {
84-
ensureAccessKeyExists(undefined);
85-
ensureUsernameExists(undefined);
84+
ensureAccessKeyExists();
85+
ensureUsernameExists();
8686

8787
const args = inputArgs.map((a) => a.trim());
8888
const actionInput = args[0]?.toLowerCase();

‎packages/cli/typescript/src/browserstack-local-testing.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function main(
2121
logger: Logger = globalThis.console
2222
) {
2323
try {
24-
const accessKey = ensureAccessKeyExists(undefined);
24+
const accessKey = ensureAccessKeyExists();
2525
const client = new LocalTestingClient({ accessKey });
2626

2727
const args = inputArgs.map((a) => a.trim());

‎packages/cli/typescript/src/browserstack-local.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ async function ensureBinHomeExists(
267267
*
268268
* @internal
269269
*/
270-
function ensureAccessKeyExists(accessKey: string | undefined): string {
270+
function ensureAccessKeyExists(accessKey?: string): string {
271271
const resolved = resolveAccessKey(accessKey);
272272
if (typeof resolved !== "string" || !resolved.trim().length) {
273273
throw new BrowserStackError("Missing accessKey");

‎packages/cli/typescript/src/browserstack-screenshots.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export async function main(
2424
logger: Logger = globalThis.console
2525
) {
2626
try {
27-
ensureAccessKeyExists(undefined);
28-
ensureUsernameExists(undefined);
27+
ensureAccessKeyExists();
28+
ensureUsernameExists();
2929

3030
const args = inputArgs.map((a) => a.trim());
3131
const actionInput = args[0]?.toLowerCase();

‎packages/cli/typescript/src/browserstack-test-management.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export async function main(
3535
logger: Logger = globalThis.console
3636
) {
3737
try {
38-
ensureAccessKeyExists(undefined);
39-
ensureUsernameExists(undefined);
38+
ensureAccessKeyExists();
39+
ensureUsernameExists();
4040

4141
const args = inputArgs.map((a) => a.trim());
4242
const actionInput = args[0]?.toLowerCase();

‎packages/cli/typescript/src/browserstack-test-reporting.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export async function main(
2828
logger: Logger = globalThis.console
2929
) {
3030
try {
31-
ensureAccessKeyExists(undefined);
32-
ensureUsernameExists(undefined);
31+
ensureAccessKeyExists();
32+
ensureUsernameExists();
3333

3434
const args = inputArgs.map((a) => a.trim());
3535
const actionInput = args[0]?.toLowerCase();

‎packages/cli/typescript/src/tui/pickers.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export async function fetchPickerItemsForAction(
112112
const found = findAction(picker.source);
113113
if (!found) return [];
114114
const { product, action } = found;
115-
const cacheKey = picker.source + ":" + Object.entries(filterValues).sort().map(([k, v]) => `${k}=${v}`).join("&");
115+
const cacheKey = picker.source + ":" + Object.entries(filterValues).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${k}=${v}`).join("&");
116116
if (cache.has(cacheKey)) return cache.get(cacheKey)!;
117117
const { output, error } = await executeAction(product, action, filterValues);
118118
if (error) {

0 commit comments

Comments
 (0)