11import { test } from 'vitest'
2- import { withFixture } from '../common'
32import * as path from 'path'
3+ import { URI } from 'vscode-uri'
4+ import { withFixture } from '../common'
45
56withFixture ( 'basic' , ( c ) => {
67 async function testDocumentLinks ( name , { text, lang, expected } ) {
@@ -19,9 +20,7 @@ withFixture('basic', (c) => {
1920 lang : 'css' ,
2021 expected : [
2122 {
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 ( ) ,
2524 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 28 } } ,
2625 } ,
2726 ] ,
@@ -32,9 +31,7 @@ withFixture('basic', (c) => {
3231 lang : 'css' ,
3332 expected : [
3433 {
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 ( ) ,
3835 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 27 } } ,
3936 } ,
4037 ] ,
@@ -58,9 +55,7 @@ withFixture('v4/basic', (c) => {
5855 lang : 'css' ,
5956 expected : [
6057 {
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 ( ) ,
6459 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 28 } } ,
6560 } ,
6661 ] ,
@@ -71,9 +66,7 @@ withFixture('v4/basic', (c) => {
7166 lang : 'css' ,
7267 expected : [
7368 {
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 ( ) ,
7770 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 27 } } ,
7871 } ,
7972 ] ,
@@ -84,9 +77,7 @@ withFixture('v4/basic', (c) => {
8477 lang : 'css' ,
8578 expected : [
8679 {
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 ( ) ,
9081 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 19 } } ,
9182 } ,
9283 ] ,
@@ -97,9 +88,7 @@ withFixture('v4/basic', (c) => {
9788 lang : 'css' ,
9889 expected : [
9990 {
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 ( ) ,
10392 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 27 } } ,
10493 } ,
10594 ] ,
@@ -110,9 +99,7 @@ withFixture('v4/basic', (c) => {
11099 lang : 'css' ,
111100 expected : [
112101 {
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 ( ) ,
116103 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 20 } } ,
117104 } ,
118105 ] ,
@@ -123,9 +110,7 @@ withFixture('v4/basic', (c) => {
123110 lang : 'css' ,
124111 expected : [
125112 {
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 ( ) ,
129114 range : { start : { line : 0 , character : 8 } , end : { line : 0 , character : 29 } } ,
130115 } ,
131116 ] ,
@@ -136,9 +121,7 @@ withFixture('v4/basic', (c) => {
136121 lang : 'css' ,
137122 expected : [
138123 {
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 ( ) ,
142125 range : { start : { line : 0 , character : 12 } , end : { line : 0 , character : 24 } } ,
143126 } ,
144127 ] ,
@@ -149,9 +132,7 @@ withFixture('v4/basic', (c) => {
149132 lang : 'css' ,
150133 expected : [
151134 {
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 ( ) ,
155136 range : { start : { line : 0 , character : 12 } , end : { line : 0 , character : 33 } } ,
156137 } ,
157138 ] ,
@@ -177,11 +158,11 @@ withFixture('v4/basic', (c) => {
177158 lang : 'css' ,
178159 expected : [
179160 {
180- target : ` file:// ${ path . resolve ( './tests/fixtures' ) . replace ( / @ / g , '%40' ) } ` ,
161+ target : URI . file ( path . resolve ( './tests/fixtures' ) ) . toString ( ) ,
181162 range : { start : { line : 1 , character : 35 } , end : { line : 1 , character : 43 } } ,
182163 } ,
183164 {
184- target : ` file:// ${ path . resolve ( './tests/fixtures' ) . replace ( / @ / g , '%40' ) } ` ,
165+ target : URI . file ( path . resolve ( './tests/fixtures' ) ) . toString ( ) ,
185166 range : { start : { line : 2 , character : 33 } , end : { line : 2 , character : 41 } } ,
186167 } ,
187168 ] ,
0 commit comments