summaryrefslogtreecommitdiff
path: root/scripts/smoke/check.js
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2023-08-04 16:53:54 +0100
committerGravatar GitHub <noreply@github.com> 2023-08-04 16:53:54 +0100
commit0fd6dc7ec7a24787ebddae7ed708f2ff3bd3ca78 (patch)
tree1551fa212fe9129a57a780997119388f2a9153bc /scripts/smoke/check.js
parent8ea6b6dedff7195fdfc9bb68bd642abe77d3fa4b (diff)
downloadastro-0fd6dc7ec7a24787ebddae7ed708f2ff3bd3ca78.tar.gz
astro-0fd6dc7ec7a24787ebddae7ed708f2ff3bd3ca78.tar.zst
astro-0fd6dc7ec7a24787ebddae7ed708f2ff3bd3ca78.zip
chore: fix issue in the check.js script (#7965)
Diffstat (limited to 'scripts/smoke/check.js')
-rw-r--r--scripts/smoke/check.js55
1 files changed, 29 insertions, 26 deletions
diff --git a/scripts/smoke/check.js b/scripts/smoke/check.js
index c8d9809ec..f574f5e5d 100644
--- a/scripts/smoke/check.js
+++ b/scripts/smoke/check.js
@@ -18,31 +18,32 @@ function checkExamples() {
for (const example of examples) {
checkPromises.push(
- limit(() =>
- new Promise((resolve) => {
- const originalConfig = prepareExample(example.name);
- let data = '';
- const child = spawn('node', ['../../packages/astro/astro.js', 'check'], {
- cwd: path.join('./examples', example.name),
- env: { ...process.env, FORCE_COLOR: 'true' },
- });
-
- child.stdout.on('data', function (buffer) {
- data += buffer.toString();
- });
-
- child.on('exit', (code) => {
- if (code !== 0) {
- console.error(data);
- }
- if (originalConfig) {
- resetExample(example.name, originalConfig);
- }
- resolve(code);
- });
- })
+ limit(
+ () =>
+ new Promise((resolve) => {
+ const originalConfig = prepareExample(example.name);
+ let data = '';
+ const child = spawn('node', ['../../packages/astro/astro.js', 'check'], {
+ cwd: path.join('./examples', example.name),
+ env: { ...process.env, FORCE_COLOR: 'true' },
+ });
+
+ child.stdout.on('data', function (buffer) {
+ data += buffer.toString();
+ });
+
+ child.on('exit', (code) => {
+ if (code !== 0) {
+ console.error(data);
+ }
+ if (originalConfig) {
+ resetExample(example.name, originalConfig);
+ }
+ resolve(code);
+ });
+ })
)
- )
+ );
}
Promise.all(checkPromises).then((codes) => {
@@ -50,7 +51,7 @@ function checkExamples() {
process.exit(1);
}
- console.log("No errors found!");
+ console.log('No errors found!');
});
}
@@ -75,7 +76,9 @@ function prepareExample(examplePath) {
});
}
- writeFileSync(tsconfigPath, JSON.stringify(tsconfig.config));
+ if (tsconfig.config) {
+ writeFileSync(tsconfigPath, JSON.stringify(tsconfig.config));
+ }
return originalConfig;
}