mirror of
https://github.com/gromlab-ru/svg-sprites.git
synced 2026-07-22 04:40:17 +03:00
test: добавить площадку интеграционного тестирования
- добавлены consumer fixtures для React и Next.js - добавлены typecheck, production build и браузерные smoke-тесты - добавлена интеграционная проверка в CI
This commit is contained in:
31
integration/scripts/run-workspaces.mjs
Normal file
31
integration/scripts/run-workspaces.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import { spawn } from 'node:child_process'
|
||||
import process from 'node:process'
|
||||
|
||||
import { apps } from './apps.mjs'
|
||||
|
||||
const script = process.argv[2]
|
||||
const requestedApps = new Set(process.argv.slice(3))
|
||||
|
||||
if (!script) {
|
||||
throw new Error('Usage: node scripts/run-workspaces.mjs <script> [app ...]')
|
||||
}
|
||||
|
||||
const selectedApps = requestedApps.size === 0
|
||||
? apps
|
||||
: apps.filter(({ id }) => requestedApps.has(id))
|
||||
|
||||
for (const { id } of selectedApps) {
|
||||
console.log(`\n[${id}] npm run ${script}`)
|
||||
|
||||
const exitCode = await new Promise((resolve, reject) => {
|
||||
const child = spawn('npm', ['run', script, '--workspace', `@svg-sprites-fixtures/${id}`, '--if-present'], {
|
||||
stdio: 'inherit',
|
||||
shell: process.platform === 'win32',
|
||||
})
|
||||
|
||||
child.once('error', reject)
|
||||
child.once('exit', (code) => resolve(code ?? 1))
|
||||
})
|
||||
|
||||
if (exitCode !== 0) process.exit(exitCode)
|
||||
}
|
||||
Reference in New Issue
Block a user