Skip to content

Commit 6aa70d8

Browse files
committed
Update test_rescriptdep.ml and rescript.json for improved project structure and dependency tracking
1 parent fdd2c76 commit 6aa70d8

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

test/fixtures/rescript.json

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,48 @@
44
"name": "App",
55
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/src/app.res",
66
"dependencies": [
7+
{
8+
"name": "Comp0",
9+
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/src/comp0.res"
10+
},
711
{
812
"name": "Logger",
913
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/src/logger.res"
1014
},
1115
{
1216
"name": "Math",
1317
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/src/math.res"
18+
},
19+
{
20+
"name": "React",
21+
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/node_modules/@rescript/react/src"
1422
}
1523
],
1624
"dependents": [],
1725
"fan_in": 0,
26+
"fan_out": 4,
27+
"in_cycle": false
28+
},
29+
{
30+
"name": "Comp0",
31+
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/src/comp0.res",
32+
"dependencies": [
33+
{
34+
"name": "React",
35+
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/node_modules/@rescript/react/src"
36+
},
37+
{
38+
"name": "ReactDOM",
39+
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/node_modules/@rescript/react/src"
40+
}
41+
],
42+
"dependents": [
43+
{
44+
"name": "App",
45+
"path": "/Users/woonki/GitHub/projects/rescriptdep/test/rescript/src/app.res"
46+
}
47+
],
48+
"fan_in": 1,
1849
"fan_out": 2,
1950
"in_cycle": false
2051
},
@@ -68,11 +99,11 @@
6899
],
69100
"cycles": [],
70101
"metrics": {
71-
"total_modules": 4,
72-
"average_fan_in": 0.75,
73-
"average_fan_out": 0.75,
74-
"most_depended_upon": {"module": "Logger", "count": 1},
75-
"most_dependencies": {"module": "App", "count": 2},
102+
"total_modules": 5,
103+
"average_fan_in": 0.8,
104+
"average_fan_out": 1.4,
105+
"most_depended_upon": {"module": "Comp0", "count": 1},
106+
"most_dependencies": {"module": "App", "count": 4},
76107
"cycles_count": 0
77108
}
78109
}

test/test_rescriptdep.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ open Printf
55
let run_rescriptdep_to_temp project_dir =
66
let temp_file = Filename.temp_file "rescriptdep_" ".json" in
77
let cmd =
8-
Printf.sprintf "dune exec -- rescriptdep --format json %s -o %s" project_dir
9-
temp_file
8+
Printf.sprintf "dune exec -- rescriptdep -f json %s -o %s --no-cache"
9+
project_dir temp_file
1010
in
1111
let exit_code = Sys.command cmd in
1212
if exit_code <> 0 then
@@ -25,7 +25,7 @@ let test_project_fixtures project_name =
2525
printf "Testing rescriptdep on %s project...\n" project_name;
2626

2727
(* Create paths *)
28-
let project_dir = Printf.sprintf "test/%s" project_name in
28+
let project_dir = Printf.sprintf "test/%s/lib/bs" project_name in
2929
let reference_output = Printf.sprintf "test/fixtures/%s.json" project_name in
3030

3131
(* Ensure fixtures directory exists *)

0 commit comments

Comments
 (0)