forked from datocms/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-checks.js
40 lines (35 loc) · 822 Bytes
/
run-checks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { execSync } = require("child_process");
const TESTABLE_PLUGINS = [
"star-rating-editor",
"yandex-translate",
"todo-list",
"tag-editor",
"lorem-ipsum",
"notes",
"conditional-fields",
"shopify-product",
"commercelayer",
];
const runTests = (path) => {
const root = process.cwd();
process.chdir(path);
execSync("npm i", { stdio: [0, 1, 2] });
let testExitCode = 0;
try {
execSync("npm run lint && npm run dist", { stdio: [0, 1, 2] });
} catch (error) {
testExitCode = 1;
} finally {
process.chdir(root);
}
return testExitCode;
};
let finalExitCode = 0;
TESTABLE_PLUGINS.forEach((path) => {
console.log(`\nRunning tests for '${path}'`);
const testExitCode = runTests(path);
if (testExitCode !== 0) {
finalExitCode = 1;
}
});
process.exit(finalExitCode);