GoogleCloudPlatform / GoogleCloudPlatform/functions-framework-nodejs
Feature request: allow overriding `ignoredRoutes` in `getTestServer()`
- Ngôn ngữ chính
- TypeScript
- Star
- 1.4k
- Fork
- 181
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
`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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Xác định entry point getTestServer() và kiểm tra cách nó gọi getServer(), tập trung vào tùy chọn ignoredRoutes được hard-code. Thêm options bag tùy chọn được mô tả trong issue, giữ nguyên hành vi mặc định hiện tại và xác minh rằng ignoredRoutes có thể được ghi đè trong khi các lệnh gọi hiện có vẫn tương thích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- backend, testing
- Loại issue
- Tính năng
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100