Skip to content

Commit 10d9f3e

Browse files
authored
Update fix-html-snapshot.js (#135)
When test fails it always gets snapshot.source as undefined, leading to displaying this error of replace is not defined in undefined rather then showing initial cause of error in failed test. probably we need to make sure snapshot always have source, even empty one returned when it's created, but it's easier fix, considering i'm not aware of whole codebase yet.
1 parent 1b15527 commit 10d9f3e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/model/snapshot-store/fix-html-snapshot.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const mapAttr = ($, snapshot, attrName) => {
5454

5555
module.exports = snapshot => {
5656
// disable script tags
57+
snapshot.source = snapshot.source || '';
5758
let $ = cheerio.load(snapshot.source.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''));
5859

5960
// Convert links

0 commit comments

Comments
 (0)