summaryrefslogtreecommitdiff
path: root/scripts/smoke/index.js
diff options
context:
space:
mode:
authorGravatar Fred K. Schott <fkschott@gmail.com> 2021-12-13 14:31:18 -0800
committerGravatar GitHub <noreply@github.com> 2021-12-13 14:31:18 -0800
commita6561556292c54cab8cdd2d21871f6fefa2d2779 (patch)
treefba7489fbabec0487c66205722a8a49f239099b1 /scripts/smoke/index.js
parentbc080288fe285c83c052cc5ea717aa67ce7142fc (diff)
downloadastro-a6561556292c54cab8cdd2d21871f6fefa2d2779.tar.gz
astro-a6561556292c54cab8cdd2d21871f6fefa2d2779.tar.zst
astro-a6561556292c54cab8cdd2d21871f6fefa2d2779.zip
improve our smoke tests to run on all examples (#2174)
* improve smoke test * chore(lint): Prettier fix Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'scripts/smoke/index.js')
-rw-r--r--scripts/smoke/index.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/smoke/index.js b/scripts/smoke/index.js
new file mode 100644
index 000000000..e1e296a61
--- /dev/null
+++ b/scripts/smoke/index.js
@@ -0,0 +1,31 @@
+import fs from 'fs';
+import { execa } from 'execa';
+import { fileURLToPath } from 'url';
+
+// NOTE: Only needed for Windows, due to a Turbo bug.
+// Once Turbo works on Windows, we can remove this script
+// and update our CI to run through Turbo.
+
+export default async function run() {
+ const examplesUrl = new URL('../../examples/', import.meta.url);
+ const examplesToTest = fs
+ .readdirSync(examplesUrl)
+ .map((filename) => new URL(filename, examplesUrl))
+ .filter((fileUrl) => fs.statSync(fileUrl).isDirectory());
+ const allProjectsToTest = [...examplesToTest, new URL('../../www', import.meta.url), new URL('../../docs', import.meta.url)];
+
+ console.log('');
+ for (const projectToTest of allProjectsToTest) {
+ const filePath = fileURLToPath(projectToTest);
+ console.log(' 🤖 Testing', filePath, '\n');
+ try {
+ await execa('yarn', ['build'], { cwd: fileURLToPath(projectToTest), stdout: 'inherit', stderr: 'inherit' });
+ } catch (err) {
+ console.log(err);
+ process.exit(1);
+ }
+ console.log('\n 🤖 Test complete.');
+ }
+}
+
+run();