@@ -68,7 +68,8 @@ test.group('Routes scanner', () => {
68
68
`
69
69
)
70
70
71
- const scanner = new RoutesScanner ( string . toUnixSlash ( fs . basePath ) , [ ] )
71
+ const source = string . toUnixSlash ( fs . basePath )
72
+ const scanner = new RoutesScanner ( source , [ ] )
72
73
scanner . pathsResolver . use ( ( specifier ) => {
73
74
const [ namespace , ...rest ] = specifier . split ( '/' )
74
75
const fileName = rest . pop ( )
@@ -130,7 +131,7 @@ test.group('Routes scanner', () => {
130
131
] )
131
132
132
133
assert . deepEqual ( scanner . getControllers ( ) , [
133
- join ( fs . basePath , 'app/controllers/users_controller.ts' ) ,
134
+ join ( source , 'app/controllers/users_controller.ts' ) ,
134
135
] )
135
136
assert . snapshot ( scanner . getScannedRoutes ( ) ) . matchInline ( `
136
137
[
@@ -143,7 +144,7 @@ test.group('Routes scanner', () => {
143
144
},
144
145
"method": "index",
145
146
"name": "UsersController",
146
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
147
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
147
148
},
148
149
"domain": "root",
149
150
"methods": [
@@ -169,7 +170,7 @@ test.group('Routes scanner', () => {
169
170
},
170
171
"method": "create",
171
172
"name": "UsersController",
172
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
173
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
173
174
},
174
175
"domain": "root",
175
176
"methods": [
@@ -195,7 +196,7 @@ test.group('Routes scanner', () => {
195
196
},
196
197
"method": "store",
197
198
"name": "UsersController",
198
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
199
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
199
200
},
200
201
"domain": "root",
201
202
"methods": [
@@ -234,7 +235,7 @@ test.group('Routes scanner', () => {
234
235
},
235
236
"method": "edit",
236
237
"name": "UsersController",
237
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
238
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
238
239
},
239
240
"domain": "root",
240
241
"methods": [
@@ -260,7 +261,7 @@ test.group('Routes scanner', () => {
260
261
},
261
262
"method": "update",
262
263
"name": "UsersController",
263
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
264
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
264
265
},
265
266
"domain": "root",
266
267
"methods": [
@@ -349,7 +350,8 @@ test.group('Routes scanner', () => {
349
350
`
350
351
)
351
352
352
- const scanner = new RoutesScanner ( string . toUnixSlash ( fs . basePath ) , [ ] )
353
+ const source = string . toUnixSlash ( fs . basePath )
354
+ const scanner = new RoutesScanner ( source , [ ] )
353
355
scanner . defineRequest ( ( route ) => {
354
356
if ( route . name === 'users.store' ) {
355
357
return {
@@ -429,7 +431,7 @@ test.group('Routes scanner', () => {
429
431
] )
430
432
431
433
assert . deepEqual ( scanner . getControllers ( ) , [
432
- join ( fs . basePath , 'app/controllers/users_controller.ts' ) ,
434
+ join ( source , 'app/controllers/users_controller.ts' ) ,
433
435
] )
434
436
assert . snapshot ( scanner . getScannedRoutes ( ) ) . matchInline ( `
435
437
[
@@ -442,7 +444,7 @@ test.group('Routes scanner', () => {
442
444
},
443
445
"method": "index",
444
446
"name": "UsersController",
445
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
447
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
446
448
},
447
449
"domain": "root",
448
450
"methods": [
@@ -468,7 +470,7 @@ test.group('Routes scanner', () => {
468
470
},
469
471
"method": "create",
470
472
"name": "UsersController",
471
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
473
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
472
474
},
473
475
"domain": "root",
474
476
"methods": [
@@ -494,7 +496,7 @@ test.group('Routes scanner', () => {
494
496
},
495
497
"method": "store",
496
498
"name": "UsersController",
497
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
499
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
498
500
},
499
501
"domain": "root",
500
502
"methods": [
@@ -535,7 +537,7 @@ test.group('Routes scanner', () => {
535
537
},
536
538
"method": "edit",
537
539
"name": "UsersController",
538
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
540
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
539
541
},
540
542
"domain": "root",
541
543
"methods": [
@@ -561,7 +563,7 @@ test.group('Routes scanner', () => {
561
563
},
562
564
"method": "update",
563
565
"name": "UsersController",
564
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
566
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
565
567
},
566
568
"domain": "root",
567
569
"methods": [
@@ -650,7 +652,8 @@ test.group('Routes scanner', () => {
650
652
`
651
653
)
652
654
653
- const scanner = new RoutesScanner ( string . toUnixSlash ( fs . basePath ) , [ ] )
655
+ const source = string . toUnixSlash ( fs . basePath )
656
+ const scanner = new RoutesScanner ( source , [ ] )
654
657
scanner . pathsResolver . use ( ( specifier ) => {
655
658
const [ namespace , ...rest ] = specifier . split ( '/' )
656
659
const fileName = rest . pop ( )
@@ -722,7 +725,7 @@ test.group('Routes scanner', () => {
722
725
},
723
726
"method": "index",
724
727
"name": "UsersController",
725
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
728
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
726
729
},
727
730
"domain": "root",
728
731
"methods": [
@@ -748,7 +751,7 @@ test.group('Routes scanner', () => {
748
751
},
749
752
"method": "create",
750
753
"name": "UsersController",
751
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
754
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
752
755
},
753
756
"domain": "root",
754
757
"methods": [
@@ -774,7 +777,7 @@ test.group('Routes scanner', () => {
774
777
},
775
778
"method": "store",
776
779
"name": "UsersController",
777
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
780
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
778
781
},
779
782
"domain": "root",
780
783
"methods": [
@@ -813,7 +816,7 @@ test.group('Routes scanner', () => {
813
816
},
814
817
"method": "edit",
815
818
"name": "UsersController",
816
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
819
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
817
820
},
818
821
"domain": "root",
819
822
"methods": [
@@ -839,7 +842,7 @@ test.group('Routes scanner', () => {
839
842
},
840
843
"method": "update",
841
844
"name": "UsersController",
842
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
845
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
843
846
},
844
847
"domain": "root",
845
848
"methods": [
@@ -932,7 +935,8 @@ test.group('Routes scanner', () => {
932
935
`
933
936
)
934
937
935
- const scanner = new RoutesScanner ( string . toUnixSlash ( fs . basePath ) , [ ] )
938
+ const source = string . toUnixSlash ( fs . basePath )
939
+ const scanner = new RoutesScanner ( source , [ ] )
936
940
scanner . pathsResolver . use ( ( specifier ) => {
937
941
const [ namespace , ...rest ] = specifier . split ( '/' )
938
942
const fileName = rest . pop ( )
@@ -994,7 +998,7 @@ test.group('Routes scanner', () => {
994
998
},
995
999
"method": "index",
996
1000
"name": "UsersController",
997
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
1001
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
998
1002
},
999
1003
"domain": "root",
1000
1004
"methods": [
@@ -1020,7 +1024,7 @@ test.group('Routes scanner', () => {
1020
1024
},
1021
1025
"method": "store",
1022
1026
"name": "UsersController",
1023
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
1027
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
1024
1028
},
1025
1029
"domain": "root",
1026
1030
"methods": [
@@ -1059,7 +1063,7 @@ test.group('Routes scanner', () => {
1059
1063
},
1060
1064
"method": "index",
1061
1065
"name": "PostsController",
1062
- "path": "${ join ( fs . basePath , '/app/controllers/posts_controller.ts' ) } ",
1066
+ "path": "${ join ( source , '/app/controllers/posts_controller.ts' ) } ",
1063
1067
},
1064
1068
"domain": "root",
1065
1069
"methods": [
@@ -1085,7 +1089,7 @@ test.group('Routes scanner', () => {
1085
1089
},
1086
1090
"method": "store",
1087
1091
"name": "PostsController",
1088
- "path": "${ join ( fs . basePath , '/app/controllers/posts_controller.ts' ) } ",
1092
+ "path": "${ join ( source , '/app/controllers/posts_controller.ts' ) } ",
1089
1093
},
1090
1094
"domain": "root",
1091
1095
"methods": [
@@ -1162,7 +1166,7 @@ test.group('Routes scanner', () => {
1162
1166
`
1163
1167
)
1164
1168
1165
- await scanner . invalidate ( join ( fs . basePath , 'app/controllers/users_controller.ts' ) )
1169
+ await scanner . invalidate ( join ( source , 'app/controllers/users_controller.ts' ) )
1166
1170
assert . snapshot ( scanner . getScannedRoutes ( ) ) . matchInline ( `
1167
1171
[
1168
1172
{
@@ -1174,7 +1178,7 @@ test.group('Routes scanner', () => {
1174
1178
},
1175
1179
"method": "index",
1176
1180
"name": "UsersController",
1177
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
1181
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
1178
1182
},
1179
1183
"domain": "root",
1180
1184
"methods": [
@@ -1200,7 +1204,7 @@ test.group('Routes scanner', () => {
1200
1204
},
1201
1205
"method": "store",
1202
1206
"name": "UsersController",
1203
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
1207
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
1204
1208
},
1205
1209
"domain": "root",
1206
1210
"methods": [
@@ -1239,7 +1243,7 @@ test.group('Routes scanner', () => {
1239
1243
},
1240
1244
"method": "index",
1241
1245
"name": "PostsController",
1242
- "path": "${ join ( fs . basePath , '/app/controllers/posts_controller.ts' ) } ",
1246
+ "path": "${ join ( source , '/app/controllers/posts_controller.ts' ) } ",
1243
1247
},
1244
1248
"domain": "root",
1245
1249
"methods": [
@@ -1265,7 +1269,7 @@ test.group('Routes scanner', () => {
1265
1269
},
1266
1270
"method": "store",
1267
1271
"name": "PostsController",
1268
- "path": "${ join ( fs . basePath , '/app/controllers/posts_controller.ts' ) } ",
1272
+ "path": "${ join ( source , '/app/controllers/posts_controller.ts' ) } ",
1269
1273
},
1270
1274
"domain": "root",
1271
1275
"methods": [
@@ -1298,7 +1302,7 @@ test.group('Routes scanner', () => {
1298
1302
]
1299
1303
` )
1300
1304
1301
- await scanner . invalidate ( join ( fs . basePath , 'app/controllers/posts_controller.ts' ) )
1305
+ await scanner . invalidate ( join ( source , 'app/controllers/posts_controller.ts' ) )
1302
1306
assert . snapshot ( scanner . getScannedRoutes ( ) ) . matchInline ( `
1303
1307
[
1304
1308
{
@@ -1310,7 +1314,7 @@ test.group('Routes scanner', () => {
1310
1314
},
1311
1315
"method": "index",
1312
1316
"name": "UsersController",
1313
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
1317
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
1314
1318
},
1315
1319
"domain": "root",
1316
1320
"methods": [
@@ -1336,7 +1340,7 @@ test.group('Routes scanner', () => {
1336
1340
},
1337
1341
"method": "store",
1338
1342
"name": "UsersController",
1339
- "path": "${ join ( fs . basePath , '/app/controllers/users_controller.ts' ) } ",
1343
+ "path": "${ join ( source , '/app/controllers/users_controller.ts' ) } ",
1340
1344
},
1341
1345
"domain": "root",
1342
1346
"methods": [
@@ -1375,7 +1379,7 @@ test.group('Routes scanner', () => {
1375
1379
},
1376
1380
"method": "index",
1377
1381
"name": "PostsController",
1378
- "path": "${ join ( fs . basePath , '/app/controllers/posts_controller.ts' ) } ",
1382
+ "path": "${ join ( source , '/app/controllers/posts_controller.ts' ) } ",
1379
1383
},
1380
1384
"domain": "root",
1381
1385
"methods": [
@@ -1401,7 +1405,7 @@ test.group('Routes scanner', () => {
1401
1405
},
1402
1406
"method": "store",
1403
1407
"name": "PostsController",
1404
- "path": "${ join ( fs . basePath , '/app/controllers/posts_controller.ts' ) } ",
1408
+ "path": "${ join ( source , '/app/controllers/posts_controller.ts' ) } ",
1405
1409
},
1406
1410
"domain": "root",
1407
1411
"methods": [
0 commit comments