|
| 1 | +import { describe, expect, it } from 'vitest'; |
| 2 | +import { isExpectedLiveConsoleError } from '../e2e/live-console-errors'; |
| 3 | + |
| 4 | +describe('live console error filtering', () => { |
| 5 | + it.each([ |
| 6 | + ['missing repository configuration', 'Missing data-repo attribute'], |
| 7 | + ['Google Fonts resource warning', 'Font https://fonts.gstatic.com/s/font.woff2 returned 403'], |
| 8 | + ['generic CORS failure', 'CORS blocked a cross-origin resource'], |
| 9 | + ['failed font request', 'GET https://fonts.gstatic.com/s/font.woff2 net::ERR_FAILED'], |
| 10 | + ])('accepts the known %s error', (_name, message) => { |
| 11 | + expect(isExpectedLiveConsoleError(message)).toBe(true); |
| 12 | + }); |
| 13 | + |
| 14 | + it.each([ |
| 15 | + ['hostname suffix', 'GET https://fonts.gstatic.com.attacker.test/payload.js failed'], |
| 16 | + ['credentials', 'GET https://fonts.gstatic.com@attacker.test/payload.js failed'], |
| 17 | + ['subdomain', 'GET https://cdn.fonts.gstatic.com/font.woff2 failed'], |
| 18 | + ['query parameter', 'GET https://attacker.test/?next=https://fonts.gstatic.com failed'], |
| 19 | + ['plain-text mention', 'Unexpected script from fonts.gstatic.com executed'], |
| 20 | + ])('does not hide an unrelated error containing a %s', (_name, message) => { |
| 21 | + expect(isExpectedLiveConsoleError(message)).toBe(false); |
| 22 | + }); |
| 23 | +}); |
0 commit comments