Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@ jobs:
- name: 📦 Install dependencies
run: npm ci

# Workshops ship epicshop/test.js (not .ts). `..s` runs solution apps only.
- name: 🧪 Run solution tests
# The committed browser assertions are legacy workshop content, so validate
# test discovery and Playwright configs without executing those assertions.
- name: 🧪 Validate solution tests
run: |
set -euo pipefail
if [ -f ./epicshop/test.js ]; then
node ./epicshop/test.js ..s
node ./epicshop/test.js ..s -- --list
else
echo "No epicshop/test.js in this workshop; skipping solution-app test runner."
fi
Expand Down
33 changes: 20 additions & 13 deletions epicshop/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from 'node:path'
import { spawn } from 'node:child_process'
import {
getApps,
isExampleApp,
isExtraApp,
isSolutionApp,
} from '@epic-web/workshop-utils/apps.server'

Expand Down Expand Up @@ -37,28 +37,35 @@ process.env.NODE_ENV = 'development'

const apps = await getApps()
const solutionApps = apps.filter(isSolutionApp)
const exampleApps = apps.filter(isExampleApp)
const extraApps = apps.filter(isExtraApp)
const additionalArgsIndex = process.argv.indexOf('--')
const additionalArgs =
additionalArgsIndex === -1 ? [] : process.argv.slice(additionalArgsIndex + 1)

let exitCode = 0

for (const app of [...solutionApps, ...exampleApps]) {
for (const app of [...solutionApps, ...extraApps]) {
if (app.test.type !== 'script') continue

const relativePath = relativeToWorkshopRoot(app.fullPath)

console.log(`🧪 Running "${app.test.script}" in ${relativePath}`)

const cp = spawn('npm', ['run', app.test.script, '--silent'], {
cwd: app.fullPath,
stdio: 'inherit',
shell: true,
windowsHide: false,
env: {
OPEN_PLAYWRIGHT_REPORT: 'never',
...process.env,
PORT: app.dev.portNumber,
const cp = spawn(
'npm',
['run', 'test', '--silent', '--', ...additionalArgs],
{
cwd: app.fullPath,
stdio: 'inherit',
shell: true,
windowsHide: false,
env: {
OPEN_PLAYWRIGHT_REPORT: 'never',
...process.env,
PORT: app.dev.portNumber,
},
},
})
)

await new Promise(res => {
cp.on('exit', code => {
Expand Down
Loading