File tree Expand file tree Collapse file tree 4 files changed +34
-3
lines changed
Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ expectType<EditorInfo>(
3030 line : 10 ,
3131 column : 2 ,
3232 } ,
33+ new URL ( 'file://path/to/file' ) ,
34+ {
35+ file : new URL ( 'file://path/to/file' ) ,
36+ } ,
3337 ] ) ,
3438) ;
3539
Original file line number Diff line number Diff line change 5252 "dependencies" : {
5353 "env-editor" : " ^1.1.0" ,
5454 "execa" : " ^9.3.0" ,
55- "line-column-path" : " ^3 .0.0" ,
55+ "line-column-path" : " ^4 .0.0" ,
5656 "open" : " ^10.1.0"
5757 },
5858 "devDependencies" : {
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ Open the given files in the user's editor at specific line and column if support
4949
5050#### files
5151
52- Type: ` Array<string | object> `
52+ Type: ` Array<string | URL | object> `
5353
5454Items should be in the format ` foo.js:1:5 ` or ` {file: 'foo.js', line: 1: column: 5} ` .
5555
Original file line number Diff line number Diff line change 1+ import url from 'node:url' ;
2+ import path from 'node:path' ;
13import test from 'ava' ;
24import { getEditorInfo } from './index.js' ;
35
46const fixtureFiles = [
57 'unicorn.js:10:20' ,
68 'rainbow.js:43:4' ,
79] ;
10+ const fixturePath = path . resolve ( '/foo.js' ) ;
11+ const fixtureUrl = url . pathToFileURL ( fixturePath ) ;
812
9- test ( 'object input ' , t => {
13+ test ( 'files ' , t => {
1014 t . deepEqual (
1115 getEditorInfo (
1216 [
@@ -31,6 +35,29 @@ test('object input', t => {
3135 isTerminalEditor : false ,
3236 } ,
3337 ) ;
38+ t . deepEqual (
39+ getEditorInfo (
40+ [
41+ fixtureUrl ,
42+ {
43+ file : fixtureUrl ,
44+ line : 43 ,
45+ column : 4 ,
46+ } ,
47+ ] ,
48+ {
49+ editor : 'sublime' ,
50+ } ,
51+ ) ,
52+ {
53+ binary : 'subl' ,
54+ arguments : [
55+ `${ fixturePath } :1:1` ,
56+ `${ fixturePath } :43:4` ,
57+ ] ,
58+ isTerminalEditor : false ,
59+ } ,
60+ ) ;
3461} ) ;
3562
3663test ( 'editor - generic' , t => {
You can’t perform that action at this time.
0 commit comments