autotel-terminal 17.0.6 → 17.0.8
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/cli.integration.test.ts +49 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-terminal",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.8",
|
|
4
4
|
"description": "Terminal dashboard for autotel traces using react-ink",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@opentelemetry/api": "^1.9.0",
|
|
56
56
|
"@opentelemetry/sdk-trace-base": "^2.6.0",
|
|
57
|
-
"autotel": "2.25.
|
|
57
|
+
"autotel": "2.25.4"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"typescript": "^5.9.3",
|
|
72
72
|
"typescript-eslint": "^8.57.1",
|
|
73
73
|
"vitest": "^4.1.0",
|
|
74
|
-
"autotel": "2.25.
|
|
74
|
+
"autotel": "2.25.4"
|
|
75
75
|
},
|
|
76
76
|
"repository": {
|
|
77
77
|
"type": "git",
|
|
@@ -24,6 +24,37 @@ import type { TerminalLogEvent } from './lib/log-model';
|
|
|
24
24
|
|
|
25
25
|
const OTLP_ROUTES = new Set(['/v1/traces', '/v1/logs', '/v1/metrics']);
|
|
26
26
|
|
|
27
|
+
async function canListenOnLoopback(): Promise<boolean> {
|
|
28
|
+
return await new Promise((resolve, reject) => {
|
|
29
|
+
const server = createServer();
|
|
30
|
+
|
|
31
|
+
server.once('error', (error) => {
|
|
32
|
+
if (
|
|
33
|
+
error &&
|
|
34
|
+
typeof error === 'object' &&
|
|
35
|
+
'code' in error &&
|
|
36
|
+
error.code === 'EPERM'
|
|
37
|
+
) {
|
|
38
|
+
resolve(false);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
reject(error);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
server.listen(0, '127.0.0.1', () => {
|
|
46
|
+
server.close((closeError) => {
|
|
47
|
+
if (closeError) {
|
|
48
|
+
reject(closeError);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
resolve(true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
27
58
|
function createTestServer(spanStream: CliTerminalSpanStream): Server {
|
|
28
59
|
const logStream = getTerminalLogStream();
|
|
29
60
|
|
|
@@ -88,6 +119,8 @@ async function postJson(
|
|
|
88
119
|
return { status: res.status, body: json };
|
|
89
120
|
}
|
|
90
121
|
|
|
122
|
+
const supportsLocalServer = await canListenOnLoopback();
|
|
123
|
+
|
|
91
124
|
describe('CLI HTTP server integration', () => {
|
|
92
125
|
let server: Server;
|
|
93
126
|
let port: number;
|
|
@@ -96,6 +129,10 @@ describe('CLI HTTP server integration', () => {
|
|
|
96
129
|
const collectedLogs: TerminalLogEvent[] = [];
|
|
97
130
|
|
|
98
131
|
beforeAll(async () => {
|
|
132
|
+
if (!supportsLocalServer) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
99
136
|
spanStream = new CliTerminalSpanStream();
|
|
100
137
|
spanStream.onSpanEnd((event) => collectedSpans.push(event));
|
|
101
138
|
getTerminalLogStream().onLog((event) => collectedLogs.push(event));
|
|
@@ -109,9 +146,21 @@ describe('CLI HTTP server integration', () => {
|
|
|
109
146
|
});
|
|
110
147
|
|
|
111
148
|
afterAll(async () => {
|
|
149
|
+
if (!supportsLocalServer) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
112
153
|
await new Promise<void>((resolve) => server.close(() => resolve()));
|
|
113
154
|
});
|
|
114
155
|
|
|
156
|
+
if (!supportsLocalServer) {
|
|
157
|
+
it.skip(
|
|
158
|
+
'skips CLI HTTP server integration when the environment cannot open local TCP ports',
|
|
159
|
+
() => {},
|
|
160
|
+
);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
115
164
|
// --- Health check ---
|
|
116
165
|
|
|
117
166
|
it('GET /healthz returns ok', async () => {
|