-
Notifications
You must be signed in to change notification settings - Fork 788
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): install Jest dependencies via TypeScript and Node (#5928)
- Loading branch information
1 parent
3d26064
commit 70c4e8a
Showing
4 changed files
with
41 additions
and
36 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,39 @@ | ||
import { exec } from 'node:child_process'; | ||
import fss from 'node:fs'; | ||
import fs from 'node:fs/promises'; | ||
import path from 'node:path' | ||
import url from 'node:url' | ||
|
||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); | ||
let found = false; | ||
|
||
const jestAdapters = (await fs.readdir(__dirname)) | ||
.filter((file) => file.startsWith('jest-')) | ||
.filter((file) => fss.statSync(path.join(__dirname, file)).isDirectory()); | ||
|
||
/** | ||
* Loop through directories start with 'jest-', e.g. `jest-27-and-under`, `jest-28`, etc. | ||
*/ | ||
for (const dir of jestAdapters) { | ||
found = true; | ||
|
||
const jestDir = path.join(__dirname, dir); | ||
console.log(`→ Installing dependencies in ${jestDir}...`); | ||
await new Promise<void>((resolve, reject) => { | ||
exec('npm ci', { cwd: jestDir }, (err) => { | ||
if (err) { | ||
reject(err); | ||
} | ||
resolve(); | ||
}); | ||
}); | ||
console.log('Done 🎉'); | ||
} | ||
|
||
/** | ||
* If no directories were found and processed, print an error and exit | ||
*/ | ||
if (!found) { | ||
console.error('Error: No jest directories were found'); | ||
process.exit(1); | ||
} |
This file was deleted.
Oops, something went wrong.