1
1
import { test } from 'vitest'
2
- import { withFixture } from '../common'
3
2
import * as path from 'path'
3
+ import { URI } from 'vscode-uri'
4
+ import { withFixture } from '../common'
4
5
5
6
withFixture ( 'basic' , ( c ) => {
6
7
async function testDocumentLinks ( name , { text, lang, expected } ) {
@@ -19,9 +20,7 @@ withFixture('basic', (c) => {
19
20
lang : 'css' ,
20
21
expected : [
21
22
{
22
- target : `file://${ path
23
- . resolve ( './tests/fixtures/basic/tailwind.config.js' )
24
- . replace ( / @ / g, '%40' ) } `,
23
+ target : URI . file ( path . resolve ( './tests/fixtures/basic/tailwind.config.js' ) ) . toString ( ) ,
25
24
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 28 } } ,
26
25
} ,
27
26
] ,
@@ -32,9 +31,7 @@ withFixture('basic', (c) => {
32
31
lang : 'css' ,
33
32
expected : [
34
33
{
35
- target : `file://${ path
36
- . resolve ( './tests/fixtures/basic/does-not-exist.js' )
37
- . replace ( / @ / g, '%40' ) } `,
34
+ target : URI . file ( path . resolve ( './tests/fixtures/basic/does-not-exist.js' ) ) . toString ( ) ,
38
35
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 27 } } ,
39
36
} ,
40
37
] ,
@@ -58,9 +55,7 @@ withFixture('v4/basic', (c) => {
58
55
lang : 'css' ,
59
56
expected : [
60
57
{
61
- target : `file://${ path
62
- . resolve ( './tests/fixtures/v4/basic/tailwind.config.js' )
63
- . replace ( / @ / g, '%40' ) } `,
58
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/tailwind.config.js' ) ) . toString ( ) ,
64
59
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 28 } } ,
65
60
} ,
66
61
] ,
@@ -71,9 +66,7 @@ withFixture('v4/basic', (c) => {
71
66
lang : 'css' ,
72
67
expected : [
73
68
{
74
- target : `file://${ path
75
- . resolve ( './tests/fixtures/v4/basic/does-not-exist.js' )
76
- . replace ( / @ / g, '%40' ) } `,
69
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/does-not-exist.js' ) ) . toString ( ) ,
77
70
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 27 } } ,
78
71
} ,
79
72
] ,
@@ -84,9 +77,7 @@ withFixture('v4/basic', (c) => {
84
77
lang : 'css' ,
85
78
expected : [
86
79
{
87
- target : `file://${ path
88
- . resolve ( './tests/fixtures/v4/basic/plugin.js' )
89
- . replace ( / @ / g, '%40' ) } `,
80
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/plugin.js' ) ) . toString ( ) ,
90
81
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 19 } } ,
91
82
} ,
92
83
] ,
@@ -97,9 +88,7 @@ withFixture('v4/basic', (c) => {
97
88
lang : 'css' ,
98
89
expected : [
99
90
{
100
- target : `file://${ path
101
- . resolve ( './tests/fixtures/v4/basic/does-not-exist.js' )
102
- . replace ( / @ / g, '%40' ) } `,
91
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/does-not-exist.js' ) ) . toString ( ) ,
103
92
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 27 } } ,
104
93
} ,
105
94
] ,
@@ -110,9 +99,7 @@ withFixture('v4/basic', (c) => {
110
99
lang : 'css' ,
111
100
expected : [
112
101
{
113
- target : `file://${ path
114
- . resolve ( './tests/fixtures/v4/basic/index.html' )
115
- . replace ( / @ / g, '%40' ) } `,
102
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/index.html' ) ) . toString ( ) ,
116
103
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 20 } } ,
117
104
} ,
118
105
] ,
@@ -123,9 +110,7 @@ withFixture('v4/basic', (c) => {
123
110
lang : 'css' ,
124
111
expected : [
125
112
{
126
- target : `file://${ path
127
- . resolve ( './tests/fixtures/v4/basic/does-not-exist.html' )
128
- . replace ( / @ / g, '%40' ) } `,
113
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/does-not-exist.html' ) ) . toString ( ) ,
129
114
range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 29 } } ,
130
115
} ,
131
116
] ,
@@ -136,9 +121,7 @@ withFixture('v4/basic', (c) => {
136
121
lang : 'css' ,
137
122
expected : [
138
123
{
139
- target : `file://${ path
140
- . resolve ( './tests/fixtures/v4/basic/index.html' )
141
- . replace ( / @ / g, '%40' ) } `,
124
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/index.html' ) ) . toString ( ) ,
142
125
range : { start : { line : 0 , character : 12 } , end : { line : 0 , character : 24 } } ,
143
126
} ,
144
127
] ,
@@ -149,9 +132,7 @@ withFixture('v4/basic', (c) => {
149
132
lang : 'css' ,
150
133
expected : [
151
134
{
152
- target : `file://${ path
153
- . resolve ( './tests/fixtures/v4/basic/does-not-exist.html' )
154
- . replace ( / @ / g, '%40' ) } `,
135
+ target : URI . file ( path . resolve ( './tests/fixtures/v4/basic/does-not-exist.html' ) ) . toString ( ) ,
155
136
range : { start : { line : 0 , character : 12 } , end : { line : 0 , character : 33 } } ,
156
137
} ,
157
138
] ,
@@ -177,11 +158,11 @@ withFixture('v4/basic', (c) => {
177
158
lang : 'css' ,
178
159
expected : [
179
160
{
180
- target : ` file:// ${ path . resolve ( './tests/fixtures' ) . replace ( / @ / g , '%40' ) } ` ,
161
+ target : URI . file ( path . resolve ( './tests/fixtures' ) ) . toString ( ) ,
181
162
range : { start : { line : 1 , character : 35 } , end : { line : 1 , character : 43 } } ,
182
163
} ,
183
164
{
184
- target : ` file:// ${ path . resolve ( './tests/fixtures' ) . replace ( / @ / g , '%40' ) } ` ,
165
+ target : URI . file ( path . resolve ( './tests/fixtures' ) ) . toString ( ) ,
185
166
range : { start : { line : 2 , character : 33 } , end : { line : 2 , character : 41 } } ,
186
167
} ,
187
168
] ,
0 commit comments