uppy/packages/@uppy/companion/__mocks__/express-prom-bundle.ts
Kevin van Zonneveld e99a17f1fe
companion: port to TypeScript (#6179)
Supersedes #6178.

This branch keeps the exact same final content as #6178, but splits
history for reviewability:

1. `chore(companion): rename source and test files from .js to .ts`
(pure `git mv`, no content changes)
2. `feat(companion): port Companion to TypeScript` (actual
content/type/schema/build updates)

Validation note:
- Final tree is byte-for-byte identical to `ts-companion`
(`7b5b16a298690b0492de4cc4fab744f998b45570`).

---------

Co-authored-by: Mikael Finstad <finstaden@gmail.com>
2026-05-04 20:50:43 +08:00

29 lines
581 B
TypeScript

class Gauge {
set = () => {}
}
export default function () {
type Req = { url?: string }
type Res = {
setHeader: (key: string, value: string) => void
end: (s?: string) => void
}
type Next = () => void
const middleware = (req: Req, res: Res, next: Next) => {
// simulate prometheus metrics endpoint:
if (req.url === '/metrics') {
res.setHeader('Content-Type', 'text/plain')
res.end('# Dummy metrics\n')
return
}
next()
}
middleware.promClient = {
collectDefaultMetrics: () => {},
Gauge,
}
return middleware
}