Skip to content

Commit e716357

Browse files
committed
test: Fix coverage for prettyDOM
1 parent b6d93ce commit e716357

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/__tests__/pretty-dom.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ test('prettyDOM prints out the given DOM element tree', () => {
2626
test('prettyDOM supports truncating the output length', () => {
2727
const {container} = render('<div>Hello World!</div>')
2828
expect(prettyDOM(container, 5)).toMatch(/\.\.\./)
29+
expect(prettyDOM(container, 0)).toMatch('')
30+
expect(prettyDOM(container, Number.POSITIVE_INFINITY)).toMatchInlineSnapshot(`
31+
"<div>
32+
<div>
33+
Hello World!
34+
</div>
35+
</div>"
36+
`)
2937
})
3038

3139
test('prettyDOM defaults to document.body', () => {

src/config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ let config: InternalConfig = {
3535
const error = new Error(
3636
[
3737
message,
38-
prettifiedDOM.length > 0
39-
? `Ignored nodes: comments, <script />, <style />\n${prettyDOM(
40-
container,
41-
)}`
42-
: null,
38+
`Ignored nodes: comments, <script />, <style />\n${prettifiedDOM}`,
4339
]
4440
.filter(Boolean)
4541
.join('\n\n'),

0 commit comments

Comments
 (0)