diff --git a/src/common/Coverage.ts b/src/common/Coverage.ts index c7be817a..3a06d874 100644 --- a/src/common/Coverage.ts +++ b/src/common/Coverage.ts @@ -407,9 +407,15 @@ export class CSSCoverage { const coverage: CoverageEntry[] = []; for (const styleSheetId of this.#stylesheetURLs.keys()) { const url = this.#stylesheetURLs.get(styleSheetId); - assert(url); + assert( + typeof url !== 'undefined', + `Stylesheet URL is undefined (styleSheetId=${styleSheetId})` + ); const text = this.#stylesheetSources.get(styleSheetId); - assert(text); + assert( + typeof text !== 'undefined', + `Stylesheet text is undefined (styleSheetId=${styleSheetId})` + ); const ranges = convertToDisjointRanges( styleSheetIdToCoverage.get(styleSheetId) || [] ); diff --git a/test/assets/csscoverage/empty.html b/test/assets/csscoverage/empty.html new file mode 100644 index 00000000..b3845c36 --- /dev/null +++ b/test/assets/csscoverage/empty.html @@ -0,0 +1,3 @@ + +