GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs

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

未关闭 适合新手
#778 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
feature request P2
主要语言
TypeScript
星标
1.4k
派生
181
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

调研方向

定位 getTestServer() 入口点,并检查它如何调用 getServer(),重点关注硬编码的 ignoredRoutes 选项。添加 issue 中描述的可选 options bag,保持当前的默认行为,并验证 ignoredRoutes 可以被覆盖,同时现有调用仍保持兼容。

由索引模型根据 Issue 内容生成。

评估

技术栈
nodejs, typescript
领域
backend, testing
Issue 类型
功能
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
基本清楚
新手友好度
68/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。