Skip to content

fix: capture CSP violations and optional console levels - #299

Open
tiagoabsantos wants to merge 1 commit into
pestphp:5.xfrom
tiagoabsantos:fix/csp-and-console-levels
Open

tiagoabsantos wants to merge 1 commit into
pestphp:5.xfrom
tiagoabsantos:fix/csp-and-console-levels

Conversation

@tiagoabsantos

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Enforced and report-only img-src violations fail assertNoJavaScriptErrors()
  • assertNoConsoleLogs() still ignores console.error, warn, info, and debug
  • assertNoConsoleLogs('error') and assertNoConsoleLogs(['error', 'warn']) fail with the matching messages
  • An unknown level throws InvalidArgumentException
  • Pint, Rector, PHPStan, and type coverage

assertNoJavaScriptErrors() missed securitypolicyviolation, so a
report-only Content-Security-Policy could still pass. Record those
violations.

assertNoConsoleLogs() keeps checking console.log only, and now accepts
levels so error, warn, info, and debug can be included without turning
existing suites red.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[browser] assertNoJavaScriptErrors() misses unhandledrejection and securitypolicyviolation; assertNoConsoleLogs() only patches console.log

1 participant