Skip to content

Commit a2e248c

Browse files
committed
add ci test for playground, it should fail
1 parent 7d3c10e commit a2e248c

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

Diff for: scripts/ciTest.js

+24-16
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ function main() {
7070
// console.log('OCaml:', output)
7171
var binDir = path.join(__dirname, "..", "jscomp", "bin");
7272
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+
);
7380
// running tests for native code
7481
fs.copyFileSync(
7582
path.join(
@@ -86,17 +93,18 @@ function main() {
8693
`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`,
8794
{
8895
cwd: binDir,
89-
stdio: [0, 1, 2]
96+
stdio: [0, 1, 2],
9097
}
9198
);
99+
92100
cp.execSync(`./test.exe`, { cwd: binDir, stdio: [0, 1, 2] });
93101
}
94102

95103
// running generated js tests
96104
if (mochaTest) {
97105
cp.execSync(`mocha jscomp/test/**/*test.js`, {
98106
cwd: path.join(__dirname, ".."),
99-
stdio: [0, 1, 2]
107+
stdio: [0, 1, 2],
100108
});
101109
}
102110

@@ -106,14 +114,14 @@ function main() {
106114
console.log("install bucklescript globally");
107115
cp.execSync("sudo npm i -g --unsafe-perm . && bsc -bs-internal-check", {
108116
cwd: path.join(__dirname, ".."),
109-
stdio: [0, 1, 2]
117+
stdio: [0, 1, 2],
110118
});
111119
}
112120

113121
var bsbDir = cp
114122
.execSync(`bsb -where`, {
115123
cwd: path.join(__dirname, ".."),
116-
encoding: "utf8"
124+
encoding: "utf8",
117125
})
118126
.trim();
119127

@@ -125,8 +133,8 @@ function main() {
125133
var themes = themeOutput
126134
.split("\n")
127135
.slice(1)
128-
.map(x => x.trim())
129-
.filter(x => x);
136+
.map((x) => x.trim())
137+
.filter((x) => x);
130138
var themesDir = path.join(__dirname, "..", "themes");
131139

132140
if (fs.existsSync(themesDir)) {
@@ -136,30 +144,30 @@ function main() {
136144
// since it is useful for debugging
137145
}
138146
fs.mkdirSync(themesDir);
139-
themes.forEach(function(theme) {
147+
themes.forEach(function (theme) {
140148
cp.exec(
141149
`bsb -theme ${theme} -init ${theme}`,
142150
{ cwd: themesDir, encoding: "utf8" },
143-
function(error, stdout, stderr) {
151+
function (error, stdout, stderr) {
144152
console.log(stdout);
145153
console.log(stderr);
146154
if (error !== null) {
147155
throw new Error(`init theme ${theme} failed`);
148156
}
149157
let config = {
150158
cwd: path.join(themesDir, theme),
151-
encoding: "utf8"
159+
encoding: "utf8",
152160
};
153-
var output ;
161+
var output;
154162
try {
155163
output = cp.execSync(`npm link bs-platform`, config);
156164
output = cp.execSync(`npm install`, config);
157165
output = cp.execSync(`npm run clean`, config);
158166
output = cp.execSync(`npm run build`, config);
159167
} 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 + "");
163171
}
164172
}
165173
);
@@ -172,10 +180,10 @@ function main() {
172180
cp.execSync(`npm link bs-platform`, {
173181
cwd: buildTestDir,
174182
stdio: [0, 1, 2],
175-
encoding: "utf8"
183+
encoding: "utf8",
176184
});
177185
var files = fs.readdirSync(buildTestDir);
178-
files.forEach(function(file) {
186+
files.forEach(function (file) {
179187
var testDir = path.join(buildTestDir, file);
180188
if (file === "node_modules" || !fs.lstatSync(testDir).isDirectory()) {
181189
return;
@@ -184,7 +192,7 @@ function main() {
184192
console.warn(`input.js does not exist in ${testDir}`);
185193
} else {
186194
// 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 (
188196
error,
189197
stdout,
190198
stderr

0 commit comments

Comments
 (0)