@@ -9,8 +9,7 @@ function prettyDOM(...args) {
9
9
throw new Error ( 'process is no longer defined. Remove this setup code.' )
10
10
} else {
11
11
originalProcess = process
12
- // TODO: Delete to test browser environments
13
- // delete globalThis.process
12
+ delete globalThis . process
14
13
}
15
14
16
15
try {
@@ -23,11 +22,11 @@ function prettyDOM(...args) {
23
22
test ( 'prettyDOM prints out the given DOM element tree highlighted' , ( ) => {
24
23
const { container} = render ( '<div>Hello World!</div>' )
25
24
expect ( prettyDOM ( container ) ) . toMatchInlineSnapshot ( `
26
- [36m <div>[39m
27
- [36m <div>[39m
28
- [0mHello World![0m
29
- [36m </div>[39m
30
- [36m </div>[39m
25
+ <div>
26
+ <div>
27
+ Hello World!
28
+ </div>
29
+ </div>
31
30
` )
32
31
} )
33
32
@@ -36,21 +35,21 @@ test('prettyDOM supports truncating the output length', () => {
36
35
expect ( prettyDOM ( container , 5 ) ) . toMatch ( / \. \. \. / )
37
36
expect ( prettyDOM ( container , 0 ) ) . toMatch ( '' )
38
37
expect ( prettyDOM ( container , Number . POSITIVE_INFINITY ) ) . toMatchInlineSnapshot ( `
39
- [36m <div>[39m
40
- [36m <div>[39m
41
- [0mHello World![0m
42
- [36m </div>[39m
43
- [36m </div>[39m
38
+ <div>
39
+ <div>
40
+ Hello World!
41
+ </div>
42
+ </div>
44
43
` )
45
44
} )
46
45
47
46
test ( 'prettyDOM defaults to document.body' , ( ) => {
48
47
const defaultInlineSnapshot = `
49
- [36m <body>[39m
50
- [36m <div>[39m
51
- [0mHello World![0m
52
- [36m </div>[39m
53
- [36m </body>[39m
48
+ <body>
49
+ <div>
50
+ Hello World!
51
+ </div>
52
+ </body>
54
53
`
55
54
renderIntoDocument ( '<div>Hello World!</div>' )
56
55
expect ( prettyDOM ( ) ) . toMatchInlineSnapshot ( defaultInlineSnapshot )
@@ -59,10 +58,10 @@ test('prettyDOM defaults to document.body', () => {
59
58
60
59
test ( 'prettyDOM supports receiving the document element' , ( ) => {
61
60
expect ( prettyDOM ( document ) ) . toMatchInlineSnapshot ( `
62
- [36m <html>[39m
63
- [36m <head />[39m
64
- [36m <body />[39m
65
- [36m </html>[39m
61
+ <html>
62
+ <head />
63
+ <body />
64
+ </html>
66
65
` )
67
66
} )
68
67
@@ -90,11 +89,11 @@ test('prettyDOM ignores script elements and comments nodes by default', () => {
90
89
)
91
90
92
91
expect ( prettyDOM ( container ) ) . toMatchInlineSnapshot ( `
93
- [36m <body>[39m
94
- [36m <p>[39m
95
- [0mHello , Dave[0m
96
- [36m </p>[39m
97
- [36m </body>[39m
92
+ <body>
93
+ <p>
94
+ Hello , Dave
95
+ </p>
96
+ </body>
98
97
` )
99
98
} )
100
99
@@ -106,15 +105,15 @@ test('prettyDOM can include all elements with a custom filter', () => {
106
105
expect (
107
106
prettyDOM ( container , Number . POSITIVE_INFINITY , { filterNode : ( ) => true } ) ,
108
107
) . toMatchInlineSnapshot ( `
109
- [36m <body>[39m
110
- [36m <script[39m
111
- [33msrc[39m=[32m "context.js"[39m
112
- [36m/>[39m
113
- [90m <!-- Some comment -->[39m
114
- [36m <p>[39m
115
- [0mHello , Dave[0m
116
- [36m </p>[39m
117
- [36m </body>[39m
108
+ <body>
109
+ <script
110
+ src= "context.js"
111
+ />
112
+ <!-- Some comment -->
113
+ <p>
114
+ Hello , Dave
115
+ </p>
116
+ </body>
118
117
` )
119
118
} )
120
119
@@ -127,11 +126,11 @@ test('prettyDOM supports named custom elements', () => {
127
126
const { container} = render ( '<my-element-1>Hello World!</my-element-1>' )
128
127
129
128
expect ( prettyDOM ( container ) ) . toMatchInlineSnapshot ( `
130
- [36m <div>[39m
131
- [36m <my-element-1>[39m
132
- [0mHello World![0m
133
- [36m </my-element-1>[39m
134
- [36m </div>[39m
129
+ <div>
130
+ <my-element-1>
131
+ Hello World!
132
+ </my-element-1>
133
+ </div>
135
134
` )
136
135
} )
137
136
@@ -141,10 +140,10 @@ test('prettyDOM supports anonymous custom elements', () => {
141
140
const { container} = render ( '<my-element-2>Hello World!</my-element-2>' )
142
141
143
142
expect ( prettyDOM ( container ) ) . toMatchInlineSnapshot ( `
144
- [36m <div>[39m
145
- [36m <my-element-2>[39m
146
- [0mHello World![0m
147
- [36m </my-element-2>[39m
148
- [36m </div>[39m
143
+ <div>
144
+ <my-element-2>
145
+ Hello World!
146
+ </my-element-2>
147
+ </div>
149
148
` )
150
149
} )
0 commit comments