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'
@@ -153,7 +154,7 @@ describe('findDeclarationLocations', () => {
153
154
word : './extension.inc' ,
154
155
position : { character : 10 , line : 2 } ,
155
156
} )
156
- expect ( result ) . toMatchInlineSnapshot ( `
157
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
157
158
Array [
158
159
Object {
159
160
"range": Object {
@@ -166,7 +167,7 @@ describe('findDeclarationLocations', () => {
166
167
"line": 0,
167
168
},
168
169
},
169
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
170
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
170
171
},
171
172
]
172
173
` )
@@ -188,7 +189,7 @@ describe('findDeclarationLocations', () => {
188
189
word : './scripts/tag-release.inc' ,
189
190
position : { character : 10 , line : 16 } ,
190
191
} )
191
- expect ( result ) . toMatchInlineSnapshot ( `
192
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
192
193
Array [
193
194
Object {
194
195
"range": Object {
@@ -201,7 +202,7 @@ describe('findDeclarationLocations', () => {
201
202
"line": 0,
202
203
},
203
204
},
204
- "uri": "file://${ REPO_ROOT_FOLDER } /scripts/tag-release.inc",
205
+ "uri": "file://__REPO_ROOT_FOLDER__ /scripts/tag-release.inc",
205
206
},
206
207
]
207
208
` )
@@ -214,7 +215,7 @@ describe('findDeclarationLocations', () => {
214
215
uri : CURRENT_URI ,
215
216
word : 'node_version' ,
216
217
} )
217
- expect ( result ) . toMatchInlineSnapshot ( `
218
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
218
219
Array [
219
220
Object {
220
221
"range": Object {
@@ -239,7 +240,7 @@ describe('findDeclarationLocations', () => {
239
240
uri : FIXTURE_URI . SCOPE ,
240
241
word : 'X' ,
241
242
} )
242
- expect ( result ) . toMatchInlineSnapshot ( `
243
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
243
244
Array [
244
245
Object {
245
246
"range": Object {
@@ -252,7 +253,7 @@ describe('findDeclarationLocations', () => {
252
253
"line": 12,
253
254
},
254
255
},
255
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
256
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
256
257
},
257
258
]
258
259
` )
@@ -264,7 +265,7 @@ describe('findDeclarationLocations', () => {
264
265
uri : FIXTURE_URI . SCOPE ,
265
266
word : 'i' ,
266
267
} )
267
- expect ( result ) . toMatchInlineSnapshot ( `
268
+ expect ( updateSnapshotUris ( result ) ) . toMatchInlineSnapshot ( `
268
269
Array [
269
270
Object {
270
271
"range": Object {
@@ -277,7 +278,7 @@ describe('findDeclarationLocations', () => {
277
278
"line": 37,
278
279
},
279
280
},
280
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
281
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
281
282
},
282
283
]
283
284
` )
@@ -434,12 +435,14 @@ describe('findDeclarationsMatchingWord', () => {
434
435
} )
435
436
436
437
expect (
437
- analyzer . findDeclarationsMatchingWord ( {
438
- word : 'npm_config_logl' ,
439
- uri : FIXTURE_URI . INSTALL ,
440
- exactMatch : false ,
441
- position : { line : 1000 , character : 0 } ,
442
- } ) ,
438
+ updateSnapshotUris (
439
+ analyzer . findDeclarationsMatchingWord ( {
440
+ word : 'npm_config_logl' ,
441
+ uri : FIXTURE_URI . INSTALL ,
442
+ exactMatch : false ,
443
+ position : { line : 1000 , character : 0 } ,
444
+ } ) ,
445
+ ) ,
443
446
) . toMatchInlineSnapshot ( `
444
447
Array [
445
448
Object {
@@ -455,7 +458,7 @@ describe('findDeclarationsMatchingWord', () => {
455
458
"line": 40,
456
459
},
457
460
},
458
- "uri": "file://${ FIXTURE_FOLDER } install.sh",
461
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ install.sh",
459
462
},
460
463
"name": "npm_config_loglevel",
461
464
},
@@ -472,12 +475,14 @@ describe('findDeclarationsMatchingWord', () => {
472
475
) . toMatchInlineSnapshot ( `Array []` )
473
476
474
477
expect (
475
- analyzer . findDeclarationsMatchingWord ( {
476
- word : 'BLU' ,
477
- uri : FIXTURE_URI . INSTALL ,
478
- exactMatch : false ,
479
- position : { line : 6 , character : 9 } ,
480
- } ) ,
478
+ updateSnapshotUris (
479
+ analyzer . findDeclarationsMatchingWord ( {
480
+ word : 'BLU' ,
481
+ uri : FIXTURE_URI . INSTALL ,
482
+ exactMatch : false ,
483
+ position : { line : 6 , character : 9 } ,
484
+ } ) ,
485
+ ) ,
481
486
) . toMatchInlineSnapshot ( `
482
487
Array [
483
488
Object {
@@ -493,20 +498,22 @@ describe('findDeclarationsMatchingWord', () => {
493
498
"line": 6,
494
499
},
495
500
},
496
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
501
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
497
502
},
498
503
"name": "BLUE",
499
504
},
500
505
]
501
506
` )
502
507
503
508
expect (
504
- analyzer . findDeclarationsMatchingWord ( {
505
- word : 'BLU' ,
506
- uri : FIXTURE_URI . SOURCING ,
507
- exactMatch : false ,
508
- position : { line : 6 , character : 9 } ,
509
- } ) ,
509
+ updateSnapshotUris (
510
+ analyzer . findDeclarationsMatchingWord ( {
511
+ word : 'BLU' ,
512
+ uri : FIXTURE_URI . SOURCING ,
513
+ exactMatch : false ,
514
+ position : { line : 6 , character : 9 } ,
515
+ } ) ,
516
+ ) ,
510
517
) . toMatchInlineSnapshot ( `
511
518
Array [
512
519
Object {
@@ -522,7 +529,7 @@ describe('findDeclarationsMatchingWord', () => {
522
529
"line": 6,
523
530
},
524
531
},
525
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
532
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
526
533
},
527
534
"name": "BLUE",
528
535
},
@@ -553,12 +560,14 @@ describe('findDeclarationsMatchingWord', () => {
553
560
) . toMatchInlineSnapshot ( `Array []` )
554
561
555
562
expect (
556
- analyzer . findDeclarationsMatchingWord ( {
557
- word : 'BLU' ,
558
- uri : FIXTURE_URI . SOURCING ,
559
- exactMatch : false ,
560
- position : { line : 6 , character : 9 } ,
561
- } ) ,
563
+ updateSnapshotUris (
564
+ analyzer . findDeclarationsMatchingWord ( {
565
+ word : 'BLU' ,
566
+ uri : FIXTURE_URI . SOURCING ,
567
+ exactMatch : false ,
568
+ position : { line : 6 , character : 9 } ,
569
+ } ) ,
570
+ ) ,
562
571
) . toMatchInlineSnapshot ( `
563
572
Array [
564
573
Object {
@@ -574,7 +583,7 @@ describe('findDeclarationsMatchingWord', () => {
574
583
"line": 6,
575
584
},
576
585
},
577
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
586
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
578
587
},
579
588
"name": "BLUE",
580
589
},
@@ -604,7 +613,7 @@ describe('findDeclarationsMatchingWord', () => {
604
613
expect ( findWordFromLine ( 'f' , 0 ) ) . toEqual ( [ ] )
605
614
606
615
// First definition
607
- expect ( findWordFromLine ( 'X' , 3 ) ) . toMatchInlineSnapshot ( `
616
+ expect ( updateSnapshotUris ( findWordFromLine ( 'X' , 3 ) ) ) . toMatchInlineSnapshot ( `
608
617
Array [
609
618
Object {
610
619
"kind": 13,
@@ -619,15 +628,15 @@ describe('findDeclarationsMatchingWord', () => {
619
628
"line": 2,
620
629
},
621
630
},
622
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
631
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
623
632
},
624
633
"name": "X",
625
634
},
626
635
]
627
636
` )
628
637
629
638
// Local variable definition
630
- expect ( findWordFromLine ( 'X' , 13 ) ) . toMatchInlineSnapshot ( `
639
+ expect ( updateSnapshotUris ( findWordFromLine ( 'X' , 13 ) ) ) . toMatchInlineSnapshot ( `
631
640
Array [
632
641
Object {
633
642
"containerName": "g",
@@ -643,15 +652,15 @@ describe('findDeclarationsMatchingWord', () => {
643
652
"line": 12,
644
653
},
645
654
},
646
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
655
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
647
656
},
648
657
"name": "X",
649
658
},
650
659
]
651
660
` )
652
661
653
662
// Local function definition
654
- expect ( findWordFromLine ( 'f' , 23 ) ) . toMatchInlineSnapshot ( `
663
+ expect ( updateSnapshotUris ( findWordFromLine ( 'f' , 23 ) ) ) . toMatchInlineSnapshot ( `
655
664
Array [
656
665
Object {
657
666
"containerName": "g",
@@ -667,15 +676,15 @@ describe('findDeclarationsMatchingWord', () => {
667
676
"line": 18,
668
677
},
669
678
},
670
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
679
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
671
680
},
672
681
"name": "f",
673
682
},
674
683
]
675
684
` )
676
685
677
686
// Last definition
678
- expect ( findWordFromLine ( 'X' , 1000 ) ) . toMatchInlineSnapshot ( `
687
+ expect ( updateSnapshotUris ( findWordFromLine ( 'X' , 1000 ) ) ) . toMatchInlineSnapshot ( `
679
688
Array [
680
689
Object {
681
690
"kind": 13,
@@ -690,14 +699,14 @@ describe('findDeclarationsMatchingWord', () => {
690
699
"line": 4,
691
700
},
692
701
},
693
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
702
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
694
703
},
695
704
"name": "X",
696
705
},
697
706
]
698
707
` )
699
708
700
- expect ( findWordFromLine ( 'f' , 1000 ) ) . toMatchInlineSnapshot ( `
709
+ expect ( updateSnapshotUris ( findWordFromLine ( 'f' , 1000 ) ) ) . toMatchInlineSnapshot ( `
701
710
Array [
702
711
Object {
703
712
"kind": 12,
@@ -712,15 +721,15 @@ describe('findDeclarationsMatchingWord', () => {
712
721
"line": 7,
713
722
},
714
723
},
715
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
724
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
716
725
},
717
726
"name": "f",
718
727
},
719
728
]
720
729
` )
721
730
722
731
// Global variable defined inside a function
723
- expect ( findWordFromLine ( 'GLOBAL_1' , 1000 ) ) . toMatchInlineSnapshot ( `
732
+ expect ( updateSnapshotUris ( findWordFromLine ( 'GLOBAL_1' , 1000 ) ) ) . toMatchInlineSnapshot ( `
724
733
Array [
725
734
Object {
726
735
"containerName": "g",
@@ -736,7 +745,7 @@ describe('findDeclarationsMatchingWord', () => {
736
745
"line": 13,
737
746
},
738
747
},
739
- "uri": "file://${ FIXTURE_FOLDER } scope.sh",
748
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ scope.sh",
740
749
},
741
750
"name": "GLOBAL_1",
742
751
},
@@ -868,8 +877,14 @@ describe('getAllVariables', () => {
868
877
869
878
newAnalyzer . analyze ( { uri, document } )
870
879
871
- expect ( newAnalyzer . getAllVariables ( { uri, position : { line : 20 , character : 0 } } ) )
872
- . toMatchInlineSnapshot ( `
880
+ expect (
881
+ updateSnapshotUris (
882
+ newAnalyzer . getAllVariables ( {
883
+ uri,
884
+ position : { line : 20 , character : 0 } ,
885
+ } ) ,
886
+ ) ,
887
+ ) . toMatchInlineSnapshot ( `
873
888
Array [
874
889
Object {
875
890
"kind": 13,
@@ -884,7 +899,7 @@ describe('getAllVariables', () => {
884
899
"line": 10,
885
900
},
886
901
},
887
- "uri": "file://${ FIXTURE_FOLDER } sourcing.sh",
902
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ sourcing.sh",
888
903
},
889
904
"name": "BOLD",
890
905
},
@@ -901,7 +916,7 @@ describe('getAllVariables', () => {
901
916
"line": 4,
902
917
},
903
918
},
904
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
919
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
905
920
},
906
921
"name": "RED",
907
922
},
@@ -918,7 +933,7 @@ describe('getAllVariables', () => {
918
933
"line": 5,
919
934
},
920
935
},
921
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
936
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
922
937
},
923
938
"name": "GREEN",
924
939
},
@@ -935,7 +950,7 @@ describe('getAllVariables', () => {
935
950
"line": 6,
936
951
},
937
952
},
938
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
953
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
939
954
},
940
955
"name": "BLUE",
941
956
},
@@ -952,7 +967,7 @@ describe('getAllVariables', () => {
952
967
"line": 7,
953
968
},
954
969
},
955
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
970
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
956
971
},
957
972
"name": "BOLD",
958
973
},
@@ -969,7 +984,7 @@ describe('getAllVariables', () => {
969
984
"line": 10,
970
985
},
971
986
},
972
- "uri": "file://${ FIXTURE_FOLDER } extension.inc",
987
+ "uri": "file://__REPO_ROOT_FOLDER__/testing/fixtures/ extension.inc",
973
988
},
974
989
"name": "RESET",
975
990
},
0 commit comments