5
5
FIXTURE_FOLDER ,
6
6
FIXTURE_URI ,
7
7
REPO_ROOT_FOLDER ,
8
+ updateSnapshotUris ,
8
9
} from '../../../testing/fixtures'
9
10
import Analyzer from '../analyser'
10
11
import { getDefaultConfiguration } from '../config'
@@ -122,7 +123,7 @@ describe('findDeclarationLocations', () => {
122
123
word : './extension.inc' ,
123
124
position : { character : 10 , line : 2 } ,
124
125
} )
125
- expect ( result ) . toMatchInlineSnapshot ( `
126
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
126
127
Array [
127
128
Object {
128
129
"range": Object {
@@ -135,7 +136,7 @@ describe('findDeclarationLocations', () => {
135
136
"line": 0,
136
137
},
137
138
},
138
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
139
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
139
140
},
140
141
]
141
142
` )
@@ -157,7 +158,7 @@ describe('findDeclarationLocations', () => {
157
158
word : './scripts/tag-release.inc' ,
158
159
position : { character : 10 , line : 16 } ,
159
160
} )
160
- expect ( result ) . toMatchInlineSnapshot ( `
161
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
161
162
Array [
162
163
Object {
163
164
"range": Object {
@@ -170,7 +171,7 @@ describe('findDeclarationLocations', () => {
170
171
"line": 0,
171
172
},
172
173
},
173
- "uri": "file://${ REPO_ROOT_FOLDER } /scripts/tag-release.inc",
174
+ "uri": "file://__REPO_ROOT_FOLDER__ /scripts/tag-release.inc",
174
175
},
175
176
]
176
177
` )
@@ -183,7 +184,7 @@ describe('findDeclarationLocations', () => {
183
184
uri : CURRENT_URI ,
184
185
word : 'node_version' ,
185
186
} )
186
- expect ( result ) . toMatchInlineSnapshot ( `
187
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
187
188
Array [
188
189
Object {
189
190
"range": Object {
@@ -208,7 +209,7 @@ describe('findDeclarationLocations', () => {
208
209
uri : FIXTURE_URI . SCOPE ,
209
210
word : 'X' ,
210
211
} )
211
- expect ( result ) . toMatchInlineSnapshot ( `
212
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
212
213
Array [
213
214
Object {
214
215
"range": Object {
@@ -221,7 +222,7 @@ describe('findDeclarationLocations', () => {
221
222
"line": 12,
222
223
},
223
224
},
224
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
225
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
225
226
},
226
227
]
227
228
` )
@@ -233,7 +234,7 @@ describe('findDeclarationLocations', () => {
233
234
uri : FIXTURE_URI . SCOPE ,
234
235
word : 'i' ,
235
236
} )
236
- expect ( result ) . toMatchInlineSnapshot ( `
237
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
237
238
Array [
238
239
Object {
239
240
"range": Object {
@@ -246,7 +247,7 @@ describe('findDeclarationLocations', () => {
246
247
"line": 37,
247
248
},
248
249
},
249
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
250
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
250
251
},
251
252
]
252
253
` )
@@ -403,12 +404,14 @@ describe('findDeclarationsMatchingWord', () => {
403
404
} )
404
405
405
406
expect (
406
- analyzer . findDeclarationsMatchingWord ( {
407
- word : 'npm_config_logl' ,
408
- uri : FIXTURE_URI . INSTALL ,
409
- exactMatch : false ,
410
- position : { line : 1000 , character : 0 } ,
411
- } ) ,
407
+ updateSnapshotUris (
408
+ analyzer . findDeclarationsMatchingWord ( {
409
+ word : 'npm_config_logl' ,
410
+ uri : FIXTURE_URI . INSTALL ,
411
+ exactMatch : false ,
412
+ position : { line : 1000 , character : 0 } ,
413
+ } ) ,
414
+ ) ,
412
415
) . toMatchInlineSnapshot ( `
413
416
Array [
414
417
Object {
@@ -424,7 +427,7 @@ describe('findDeclarationsMatchingWord', () => {
424
427
"line": 40,
425
428
},
426
429
},
427
- "uri": "file://${ FIXTURE_FOLDER } install.sh",
430
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ install.sh",
428
431
},
429
432
"name": "npm_config_loglevel",
430
433
},
@@ -441,12 +444,14 @@ describe('findDeclarationsMatchingWord', () => {
441
444
) . toMatchInlineSnapshot ( `Array []` )
442
445
443
446
expect (
444
- analyzer . findDeclarationsMatchingWord ( {
445
- word : 'BLU' ,
446
- uri : FIXTURE_URI . INSTALL ,
447
- exactMatch : false ,
448
- position : { line : 6 , character : 9 } ,
449
- } ) ,
447
+ updateSnapshotUris (
448
+ analyzer . findDeclarationsMatchingWord ( {
449
+ word : 'BLU' ,
450
+ uri : FIXTURE_URI . INSTALL ,
451
+ exactMatch : false ,
452
+ position : { line : 6 , character : 9 } ,
453
+ } ) ,
454
+ ) ,
450
455
) . toMatchInlineSnapshot ( `
451
456
Array [
452
457
Object {
@@ -462,20 +467,22 @@ describe('findDeclarationsMatchingWord', () => {
462
467
"line": 6,
463
468
},
464
469
},
465
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
470
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
466
471
},
467
472
"name": "BLUE",
468
473
},
469
474
]
470
475
` )
471
476
472
477
expect (
473
- analyzer . findDeclarationsMatchingWord ( {
474
- word : 'BLU' ,
475
- uri : FIXTURE_URI . SOURCING ,
476
- exactMatch : false ,
477
- position : { line : 6 , character : 9 } ,
478
- } ) ,
478
+ updateSnapshotUris (
479
+ analyzer . findDeclarationsMatchingWord ( {
480
+ word : 'BLU' ,
481
+ uri : FIXTURE_URI . SOURCING ,
482
+ exactMatch : false ,
483
+ position : { line : 6 , character : 9 } ,
484
+ } ) ,
485
+ ) ,
479
486
) . toMatchInlineSnapshot ( `
480
487
Array [
481
488
Object {
@@ -491,7 +498,7 @@ describe('findDeclarationsMatchingWord', () => {
491
498
"line": 6,
492
499
},
493
500
},
494
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
501
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
495
502
},
496
503
"name": "BLUE",
497
504
},
@@ -522,12 +529,14 @@ describe('findDeclarationsMatchingWord', () => {
522
529
) . toMatchInlineSnapshot ( `Array []` )
523
530
524
531
expect (
525
- analyzer . findDeclarationsMatchingWord ( {
526
- word : 'BLU' ,
527
- uri : FIXTURE_URI . SOURCING ,
528
- exactMatch : false ,
529
- position : { line : 6 , character : 9 } ,
530
- } ) ,
532
+ updateSnapshotUris (
533
+ analyzer . findDeclarationsMatchingWord ( {
534
+ word : 'BLU' ,
535
+ uri : FIXTURE_URI . SOURCING ,
536
+ exactMatch : false ,
537
+ position : { line : 6 , character : 9 } ,
538
+ } ) ,
539
+ ) ,
531
540
) . toMatchInlineSnapshot ( `
532
541
Array [
533
542
Object {
@@ -543,7 +552,7 @@ describe('findDeclarationsMatchingWord', () => {
543
552
"line": 6,
544
553
},
545
554
},
546
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
555
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
547
556
},
548
557
"name": "BLUE",
549
558
},
@@ -573,7 +582,7 @@ describe('findDeclarationsMatchingWord', () => {
573
582
expect ( findWordFromLine ( 'f' , 0 ) ) . toEqual ( [ ] )
574
583
575
584
// First definition
576
- expect ( findWordFromLine ( 'X' , 3 ) ) . toMatchInlineSnapshot ( `
585
+ expect ( updateSnapshotUris ( findWordFromLine ( 'X' , 3 ) ) ) . toMatchInlineSnapshot ( `
577
586
Array [
578
587
Object {
579
588
"kind": 13,
@@ -588,15 +597,15 @@ describe('findDeclarationsMatchingWord', () => {
588
597
"line": 2,
589
598
},
590
599
},
591
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
600
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
592
601
},
593
602
"name": "X",
594
603
},
595
604
]
596
605
` )
597
606
598
607
// Local variable definition
599
- expect ( findWordFromLine ( 'X' , 13 ) ) . toMatchInlineSnapshot ( `
608
+ expect ( updateSnapshotUris ( findWordFromLine ( 'X' , 13 ) ) ) . toMatchInlineSnapshot ( `
600
609
Array [
601
610
Object {
602
611
"containerName": "g",
@@ -612,15 +621,15 @@ describe('findDeclarationsMatchingWord', () => {
612
621
"line": 12,
613
622
},
614
623
},
615
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
624
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
616
625
},
617
626
"name": "X",
618
627
},
619
628
]
620
629
` )
621
630
622
631
// Local function definition
623
- expect ( findWordFromLine ( 'f' , 23 ) ) . toMatchInlineSnapshot ( `
632
+ expect ( updateSnapshotUris ( findWordFromLine ( 'f' , 23 ) ) ) . toMatchInlineSnapshot ( `
624
633
Array [
625
634
Object {
626
635
"containerName": "g",
@@ -636,15 +645,15 @@ describe('findDeclarationsMatchingWord', () => {
636
645
"line": 18,
637
646
},
638
647
},
639
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
648
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
640
649
},
641
650
"name": "f",
642
651
},
643
652
]
644
653
` )
645
654
646
655
// Last definition
647
- expect ( findWordFromLine ( 'X' , 1000 ) ) . toMatchInlineSnapshot ( `
656
+ expect ( updateSnapshotUris ( findWordFromLine ( 'X' , 1000 ) ) ) . toMatchInlineSnapshot ( `
648
657
Array [
649
658
Object {
650
659
"kind": 13,
@@ -659,14 +668,14 @@ describe('findDeclarationsMatchingWord', () => {
659
668
"line": 4,
660
669
},
661
670
},
662
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
671
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
663
672
},
664
673
"name": "X",
665
674
},
666
675
]
667
676
` )
668
677
669
- expect ( findWordFromLine ( 'f' , 1000 ) ) . toMatchInlineSnapshot ( `
678
+ expect ( updateSnapshotUris ( findWordFromLine ( 'f' , 1000 ) ) ) . toMatchInlineSnapshot ( `
670
679
Array [
671
680
Object {
672
681
"kind": 12,
@@ -681,15 +690,15 @@ describe('findDeclarationsMatchingWord', () => {
681
690
"line": 7,
682
691
},
683
692
},
684
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
693
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
685
694
},
686
695
"name": "f",
687
696
},
688
697
]
689
698
` )
690
699
691
700
// Global variable defined inside a function
692
- expect ( findWordFromLine ( 'GLOBAL_1' , 1000 ) ) . toMatchInlineSnapshot ( `
701
+ expect ( updateSnapshotUris ( findWordFromLine ( 'GLOBAL_1' , 1000 ) ) ) . toMatchInlineSnapshot ( `
693
702
Array [
694
703
Object {
695
704
"containerName": "g",
@@ -705,7 +714,7 @@ describe('findDeclarationsMatchingWord', () => {
705
714
"line": 13,
706
715
},
707
716
},
708
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
717
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
709
718
},
710
719
"name": "GLOBAL_1",
711
720
},
@@ -842,8 +851,14 @@ describe('getAllVariables', () => {
842
851
843
852
newAnalyzer . analyze ( { uri, document } )
844
853
845
- expect ( newAnalyzer . getAllVariables ( { uri, position : { line : 20 , character : 0 } } ) )
846
- . toMatchInlineSnapshot ( `
854
+ expect (
855
+ updateSnapshotUris (
856
+ newAnalyzer . getAllVariables ( {
857
+ uri,
858
+ position : { line : 20 , character : 0 } ,
859
+ } ) ,
860
+ ) ,
861
+ ) . toMatchInlineSnapshot ( `
847
862
Array [
848
863
Object {
849
864
"kind": 13,
@@ -858,7 +873,7 @@ describe('getAllVariables', () => {
858
873
"line": 10,
859
874
},
860
875
},
861
- "uri": "file://${ FIXTURE_FOLDER } sourcing.sh",
876
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ sourcing.sh",
862
877
},
863
878
"name": "BOLD",
864
879
},
@@ -875,7 +890,7 @@ describe('getAllVariables', () => {
875
890
"line": 4,
876
891
},
877
892
},
878
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
893
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
879
894
},
880
895
"name": "RED",
881
896
},
@@ -892,7 +907,7 @@ describe('getAllVariables', () => {
892
907
"line": 5,
893
908
},
894
909
},
895
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
910
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
896
911
},
897
912
"name": "GREEN",
898
913
},
@@ -909,7 +924,7 @@ describe('getAllVariables', () => {
909
924
"line": 6,
910
925
},
911
926
},
912
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
927
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
913
928
},
914
929
"name": "BLUE",
915
930
},
@@ -926,7 +941,7 @@ describe('getAllVariables', () => {
926
941
"line": 7,
927
942
},
928
943
},
929
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
944
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
930
945
},
931
946
"name": "BOLD",
932
947
},
@@ -943,7 +958,7 @@ describe('getAllVariables', () => {
943
958
"line": 10,
944
959
},
945
960
},
946
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
961
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
947
962
},
948
963
"name": "RESET",
949
964
},
0 commit comments