GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

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

Offen Anfängerfreundlich
#778 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature request P2
Vorherrschende Sprache
TypeScript
Sterne
1.4k
Forks
181
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

`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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
nodejs, typescript
Bereich
backend, testing
Issue-Typ
Feature
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.