autotel-hono 0.4.15 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/index.test.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-hono",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.17",
|
|
4
4
|
"description": "OpenTelemetry Hono middleware powered by autotel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"skills"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"autotel": "3.0.
|
|
24
|
-
"autotel-adapters": "0.2.
|
|
23
|
+
"autotel": "3.0.7",
|
|
24
|
+
"autotel-adapters": "0.2.17"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"hono": ">=4.12.18"
|
package/src/index.test.ts
CHANGED
|
@@ -191,8 +191,13 @@ describe('otel middleware', () => {
|
|
|
191
191
|
throw new Error('boom');
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
+
// Hono logs unhandled errors to console.error by default. The test
|
|
195
|
+
// intentionally throws to verify span behavior — silence the framework
|
|
196
|
+
// log so the test output stays clean.
|
|
197
|
+
const errSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
194
198
|
const res = await app.request('http://localhost/err', { method: 'GET' });
|
|
195
199
|
expect(res.status).toBe(500);
|
|
200
|
+
errSpy.mockRestore();
|
|
196
201
|
|
|
197
202
|
expect(spanCollector.span.setStatus).toHaveBeenCalledWith({ code: 2 }); // SpanStatusCode.ERROR
|
|
198
203
|
expect(spanCollector.span.recordException).toHaveBeenCalledWith(
|
|
@@ -236,8 +241,11 @@ describe('otel middleware', () => {
|
|
|
236
241
|
throw 'string throw' as unknown as Error;
|
|
237
242
|
});
|
|
238
243
|
|
|
244
|
+
// Hono surfaces the string throw via console.error; silence for the test.
|
|
245
|
+
const errSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
239
246
|
await expect(app.request('http://localhost/bad', { method: 'GET' })).rejects.toBe('string throw');
|
|
240
247
|
expect(baseSpan.end).toHaveBeenCalled();
|
|
248
|
+
errSpy.mockRestore();
|
|
241
249
|
});
|
|
242
250
|
|
|
243
251
|
it('when disableTracing is true, does not create span but still records metrics', async () => {
|