@@ -70,6 +70,13 @@ function main() {
70
70
// console.log('OCaml:', output)
71
71
var binDir = path . join ( __dirname , ".." , "jscomp" , "bin" ) ;
72
72
if ( ounitTest ) {
73
+ cp . execSync (
74
+ `ocamlc.opt -I . -c js_refmt_compiler.mli js_refmt_compiler.ml` ,
75
+ {
76
+ cwd : path . join ( __dirname , ".." , "lib" , "4.06.1" , "unstable" ) ,
77
+ stdio : [ 0 , 1 , 2 ] ,
78
+ }
79
+ ) ;
73
80
// running tests for native code
74
81
fs . copyFileSync (
75
82
path . join (
@@ -86,17 +93,18 @@ function main() {
86
93
`ocamlopt.opt -g -w -40-30 ../stubs/ext_basic_hash_stubs.c -I +compiler-libs ocamlcommon.cmxa unix.cmxa str.cmxa all_ounit_tests.ml -o test.exe` ,
87
94
{
88
95
cwd : binDir ,
89
- stdio : [ 0 , 1 , 2 ]
96
+ stdio : [ 0 , 1 , 2 ] ,
90
97
}
91
98
) ;
99
+
92
100
cp . execSync ( `./test.exe` , { cwd : binDir , stdio : [ 0 , 1 , 2 ] } ) ;
93
101
}
94
102
95
103
// running generated js tests
96
104
if ( mochaTest ) {
97
105
cp . execSync ( `mocha jscomp/test/**/*test.js` , {
98
106
cwd : path . join ( __dirname , ".." ) ,
99
- stdio : [ 0 , 1 , 2 ]
107
+ stdio : [ 0 , 1 , 2 ] ,
100
108
} ) ;
101
109
}
102
110
@@ -106,14 +114,14 @@ function main() {
106
114
console . log ( "install bucklescript globally" ) ;
107
115
cp . execSync ( "sudo npm i -g --unsafe-perm . && bsc -bs-internal-check" , {
108
116
cwd : path . join ( __dirname , ".." ) ,
109
- stdio : [ 0 , 1 , 2 ]
117
+ stdio : [ 0 , 1 , 2 ] ,
110
118
} ) ;
111
119
}
112
120
113
121
var bsbDir = cp
114
122
. execSync ( `bsb -where` , {
115
123
cwd : path . join ( __dirname , ".." ) ,
116
- encoding : "utf8"
124
+ encoding : "utf8" ,
117
125
} )
118
126
. trim ( ) ;
119
127
@@ -125,8 +133,8 @@ function main() {
125
133
var themes = themeOutput
126
134
. split ( "\n" )
127
135
. slice ( 1 )
128
- . map ( x => x . trim ( ) )
129
- . filter ( x => x ) ;
136
+ . map ( ( x ) => x . trim ( ) )
137
+ . filter ( ( x ) => x ) ;
130
138
var themesDir = path . join ( __dirname , ".." , "themes" ) ;
131
139
132
140
if ( fs . existsSync ( themesDir ) ) {
@@ -136,30 +144,30 @@ function main() {
136
144
// since it is useful for debugging
137
145
}
138
146
fs . mkdirSync ( themesDir ) ;
139
- themes . forEach ( function ( theme ) {
147
+ themes . forEach ( function ( theme ) {
140
148
cp . exec (
141
149
`bsb -theme ${ theme } -init ${ theme } ` ,
142
150
{ cwd : themesDir , encoding : "utf8" } ,
143
- function ( error , stdout , stderr ) {
151
+ function ( error , stdout , stderr ) {
144
152
console . log ( stdout ) ;
145
153
console . log ( stderr ) ;
146
154
if ( error !== null ) {
147
155
throw new Error ( `init theme ${ theme } failed` ) ;
148
156
}
149
157
let config = {
150
158
cwd : path . join ( themesDir , theme ) ,
151
- encoding : "utf8"
159
+ encoding : "utf8" ,
152
160
} ;
153
- var output ;
161
+ var output ;
154
162
try {
155
163
output = cp . execSync ( `npm link bs-platform` , config ) ;
156
164
output = cp . execSync ( `npm install` , config ) ;
157
165
output = cp . execSync ( `npm run clean` , config ) ;
158
166
output = cp . execSync ( `npm run build` , config ) ;
159
167
} catch ( err ) {
160
- console . error ( `failed in theme ${ theme } ` )
161
- console . log ( output + "" )
162
- console . log ( err + "" )
168
+ console . error ( `failed in theme ${ theme } ` ) ;
169
+ console . log ( output + "" ) ;
170
+ console . log ( err + "" ) ;
163
171
}
164
172
}
165
173
) ;
@@ -172,10 +180,10 @@ function main() {
172
180
cp . execSync ( `npm link bs-platform` , {
173
181
cwd : buildTestDir ,
174
182
stdio : [ 0 , 1 , 2 ] ,
175
- encoding : "utf8"
183
+ encoding : "utf8" ,
176
184
} ) ;
177
185
var files = fs . readdirSync ( buildTestDir ) ;
178
- files . forEach ( function ( file ) {
186
+ files . forEach ( function ( file ) {
179
187
var testDir = path . join ( buildTestDir , file ) ;
180
188
if ( file === "node_modules" || ! fs . lstatSync ( testDir ) . isDirectory ( ) ) {
181
189
return ;
@@ -184,7 +192,7 @@ function main() {
184
192
console . warn ( `input.js does not exist in ${ testDir } ` ) ;
185
193
} else {
186
194
// note existsSync test already ensure that it is a directory
187
- cp . exec ( `node input.js` , { cwd : testDir , encoding : "utf8" } , function (
195
+ cp . exec ( `node input.js` , { cwd : testDir , encoding : "utf8" } , function (
188
196
error ,
189
197
stdout ,
190
198
stderr
0 commit comments