// Dev helper: serve the e2e fixtures as a fake Magento on a fixed port.
import { fixtures, startMockMagento } from './mock-magento.js'
const port = Number(process.argv[2] ?? 4900)
const m = await startMockMagento(fixtures())
const { default: http } = await import('node:http')
http.createServer((req, res) => req.pipe(http.request({ host: '127.0.0.1', port: Number(new URL(m.url).port), path: req.url, method: req.method, headers: req.headers }, r => { res.writeHead(r.statusCode!, r.headers); r.pipe(res) }))).listen(port)
console.log(`mock magento on http://127.0.0.1:${port} token=${m.token}`)
