forked from withastro/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve our smoke tests to run on all examples (withastro#2174)
* improve smoke test * chore(lint): Prettier fix Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
bc08028
commit a656155
Showing
3 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |