GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

Feature request: allow overriding `ignoredRoutes` in `getTestServer()`

Aperta Adatta ai principianti
#778 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
feature request P2
Lingua principale
TypeScript
Stelle
1.4k
Fork
181
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

`getTestServer()` hard-codes `ignoredRoutes: null`, which re-enables the default `/favicon.ico` and `/robots.txt` 404 short-circuit for HTTP functions. There's no way for a test to reproduce a production deployment that disables it via `--ignored-routes ""`, so functions that legitimately serve those paths can't be tested through `getTestServer()`.

Proposal: accept an optional options bag that overrides the `getServer` options (starting with `ignoredRoutes`), defaulting to today's behavior:

```ts
const server = getTestServer('myFn', {ignoredRoutes: ''});
```

Backward compatible since the parameter is optional. `ignoredRoutes` is the immediate need; a general options bag would also cover `timeoutMilliseconds` etc.

Version: `@google-cloud/functions-framework` 5.0.5.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Locate the getTestServer() entry point and inspect how it calls getServer(), focusing on the hard-coded ignoredRoutes option. Add the optional options bag described in the issue, preserve today’s default behavior, and verify that ignoredRoutes can be overridden while existing calls remain compatible.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
nodejs, typescript
Ambito
backend, testing
Tipo di issue
Funzionalità
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.