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"
34
45describe ( "About CRLF tests" , ( ) => {
56 it ( "should not contain CR in `<script>` contents." , ( ) => {
6- const parsed = parser . parseForESLint (
7+ const parsed = parseForESLint (
78 `<script>\r
89 export default {\r
910 computed: {\r
@@ -23,15 +24,15 @@ describe("About CRLF tests", () => {
2324 sourceType : "module" ,
2425 } ,
2526 )
26- const script = parsed . services
27- . getDocumentFragment ( )
27+ const script = parsed
28+ . services ! . getDocumentFragment ( ) !
2829 . children . find (
2930 ( 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" ) )
3233 } )
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 (
3536 `<script>\r
3637 export default {\r
3738 computed: {\r
@@ -51,6 +52,6 @@ describe("About CRLF tests", () => {
5152 sourceType : "module" ,
5253 } ,
5354 )
54- assert . ok ( parsed . ast . comments [ 0 ] . value . includes ( "\r\n" ) )
55+ assert . ok ( parsed . ast . comments ! [ 0 ] . value . includes ( "\r\n" ) )
5556 } )
5657} )
0 commit comments