Skip to content

Commit 634367f

Browse files
committed
diagnose(1874): narrow the log-format match for typecheck
1 parent 5aef1b4 commit 634367f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎src/__tests__/apple-runner-log-redaction.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ test('synthesized text entry logging stays free of observed field contents', ()
5151
assert.ok(statements.length > 0, 'expected NSLog statements in the module');
5252

5353
for (const statement of statements) {
54-
const formatMatch = statement.match(/"((?:[^"\\]|\\.)*)"/);
55-
assert.ok(formatMatch, `NSLog without a literal format string: ${statement}`);
56-
const format = formatMatch[1];
54+
const format = statement.match(/"((?:[^"\\]|\\.)*)"/)?.[1];
55+
assert.ok(format != null, `NSLog without a literal format string: ${statement}`);
5756
if (!format.includes('%@')) continue;
5857
assert.ok(
5958
allowedStringInterpolatingFormats.has(format),

0 commit comments

Comments
 (0)