1
- const assert = require ( "assert" )
2
- const parser = require ( "../src" )
1
+ import type { VElement , VText } from "../src/ast"
2
+ import { describe , it , assert } from "vitest"
3
+ import { parseForESLint } from "../src"
3
4
4
5
describe ( "About CRLF tests" , ( ) => {
5
6
it ( "should not contain CR in `<script>` contents." , ( ) => {
6
- const parsed = parser . parseForESLint (
7
+ const parsed = parseForESLint (
7
8
`<script>\r
8
9
export default {\r
9
10
computed: {\r
@@ -23,15 +24,15 @@ describe("About CRLF tests", () => {
23
24
sourceType : "module" ,
24
25
} ,
25
26
)
26
- const script = parsed . services
27
- . getDocumentFragment ( )
27
+ const script = parsed
28
+ . services ! . getDocumentFragment ( ) !
28
29
. children . find (
29
30
( child ) => child . type === "VElement" && child . name === "script" ,
30
- )
31
- assert . ok ( ! script . children [ 0 ] . value . includes ( "\r" ) )
31
+ ) as VElement
32
+ assert . ok ( ! ( script . children [ 0 ] as VText ) . value . includes ( "\r" ) )
32
33
} )
33
- it ( "should contain CRLF in script comment." , async ( ) => {
34
- const parsed = parser . parseForESLint (
34
+ it ( "should contain CRLF in script comment." , ( ) => {
35
+ const parsed = parseForESLint (
35
36
`<script>\r
36
37
export default {\r
37
38
computed: {\r
@@ -51,6 +52,6 @@ describe("About CRLF tests", () => {
51
52
sourceType : "module" ,
52
53
} ,
53
54
)
54
- assert . ok ( parsed . ast . comments [ 0 ] . value . includes ( "\r\n" ) )
55
+ assert . ok ( parsed . ast . comments ! [ 0 ] . value . includes ( "\r\n" ) )
55
56
} )
56
57
} )
0 commit comments