1
1
import { inspect } from 'vitest/utils'
2
2
import { afterEach , expect , it , test } from 'vitest'
3
- import stripAnsi from 'strip-ansi '
3
+ import { commands } from '@vitest/browser/context '
4
4
5
5
import { prettyDOM } from '@vitest/browser/utils'
6
6
@@ -12,28 +12,28 @@ it('utils package correctly uses loupe', async () => {
12
12
expect ( inspect ( { test : 1 } ) ) . toBe ( '{ test: 1 }' )
13
13
} )
14
14
15
- test ( 'prints default document' , ( ) => {
16
- expect ( stripAnsi ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
15
+ test ( 'prints default document' , async ( ) => {
16
+ expect ( await commands . stripVTControlCharacters ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
17
17
18
18
const div = document . createElement ( 'div' )
19
19
div . innerHTML = '<span>hello</span>'
20
20
document . body . append ( div )
21
21
22
- expect ( stripAnsi ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
22
+ expect ( await commands . stripVTControlCharacters ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
23
23
} )
24
24
25
- test ( 'prints the element' , ( ) => {
25
+ test ( 'prints the element' , async ( ) => {
26
26
const div = document . createElement ( 'div' )
27
27
div . innerHTML = '<span>hello</span>'
28
28
document . body . append ( div )
29
29
30
- expect ( stripAnsi ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
30
+ expect ( await commands . stripVTControlCharacters ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
31
31
} )
32
32
33
- test ( 'prints the element with attributes' , ( ) => {
33
+ test ( 'prints the element with attributes' , async ( ) => {
34
34
const div = document . createElement ( 'div' )
35
35
div . innerHTML = '<span class="some-name" data-test-id="33" id="5">hello</span>'
36
36
document . body . append ( div )
37
37
38
- expect ( stripAnsi ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
38
+ expect ( await commands . stripVTControlCharacters ( prettyDOM ( ) ) ) . toMatchSnapshot ( )
39
39
} )
0 commit comments