File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ function makeSnippet(mark, options) {
52
52
lineEnds . push ( match . index ) ;
53
53
lineStarts . push ( match . index + match [ 0 ] . length ) ;
54
54
55
- if ( mark . position < match . index && foundLineNo < 0 ) {
55
+ if ( mark . position <= match . index && foundLineNo < 0 ) {
56
56
foundLineNo = lineStarts . length - 2 ;
57
57
}
58
58
}
Original file line number Diff line number Diff line change @@ -15,4 +15,26 @@ it('Should format errors', function () {
15
15
1 | "foo\u0001bar"
16
16
-------------^` ) ;
17
17
}
18
+
19
+ try {
20
+ yaml . load ( '*' ) ;
21
+ } catch ( err ) {
22
+ assert . strictEqual ( err . toString ( ) , `YAMLException: name of an alias node must contain at least one character (1:2)
23
+
24
+ 1 | *
25
+ ------^` ) ;
26
+ }
27
+
28
+ try {
29
+ yaml . load ( 'foo:\n bar: 1\na' ) ;
30
+ } catch ( err ) {
31
+ // eslint-disable-next-line max-len
32
+ assert . strictEqual ( err . toString ( ) , `YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key (4:1)
33
+
34
+ 1 | foo:
35
+ 2 | bar: 1
36
+ 3 | a
37
+ 4 |
38
+ -----^` ) ;
39
+ }
18
40
} ) ;
You can’t perform that action at this time.
0 commit comments