autotel-vitest 0.4.29 → 0.4.31
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/dist/index.cjs +151 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -57
- package/dist/index.js.map +1 -1
- package/dist/reporter.cjs +75 -81
- package/dist/reporter.cjs.map +1 -1
- package/dist/reporter.d.cts +11 -28
- package/dist/reporter.d.cts.map +1 -0
- package/dist/reporter.d.ts +11 -28
- package/dist/reporter.d.ts.map +1 -0
- package/dist/reporter.js +70 -76
- package/dist/reporter.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,137 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var TRACER_VERSION = "0.1.0";
|
|
12
|
-
var collector = null;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let vitest = require("vitest");
|
|
3
|
+
let autotel = require("autotel");
|
|
4
|
+
let autotel_test_span_collector = require("autotel/test-span-collector");
|
|
5
|
+
let autotel_processors = require("autotel/processors");
|
|
6
|
+
let autotel_testing = require("autotel/testing");
|
|
7
|
+
//#region src/fixture.ts
|
|
8
|
+
const TRACER_NAME = "vitest-tests";
|
|
9
|
+
const TRACER_VERSION = "0.1.0";
|
|
10
|
+
let collector = null;
|
|
13
11
|
function ensureCollector() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return collector;
|
|
12
|
+
if (!collector) {
|
|
13
|
+
collector = new autotel_test_span_collector.TestSpanCollector();
|
|
14
|
+
const provider = (0, autotel.getAutotelTracerProvider)();
|
|
15
|
+
if ("addSpanProcessor" in provider) provider.addSpanProcessor(new autotel_processors.SimpleSpanProcessor(collector));
|
|
16
|
+
}
|
|
17
|
+
return collector;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/index.ts
|
|
21
|
+
/**
|
|
22
|
+
* autotel-vitest
|
|
23
|
+
*
|
|
24
|
+
* Vitest fixture that creates one OTel span per test so all autotel-instrumented
|
|
25
|
+
* code executed during a test automatically creates child spans under it;
|
|
26
|
+
* making every test run filterable in your OTLP backend.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // vitest.config.ts: globalSetup calls init({ service: 'unit-tests' })
|
|
30
|
+
* // In spec:
|
|
31
|
+
* import { test, expect } from 'autotel-vitest';
|
|
32
|
+
* test('creates user', async () => {
|
|
33
|
+
* await userService.createUser({ email: 'test@example.com' });
|
|
34
|
+
* // All trace()/span() calls become children of the test span
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
const test = vitest.test.extend({ _otelTestSpan: [async ({ task }, use) => {
|
|
38
|
+
ensureCollector();
|
|
39
|
+
const span = (0, autotel.getTracer)(TRACER_NAME, TRACER_VERSION).startSpan(`test:${task.name}`, { attributes: {
|
|
40
|
+
"test.name": task.name,
|
|
41
|
+
"test.file": task.file?.name ?? "",
|
|
42
|
+
"test.suite": task.suite?.name ?? ""
|
|
43
|
+
} });
|
|
44
|
+
const ctx = autotel.otelTrace.setSpan(autotel.context.active(), span);
|
|
45
|
+
try {
|
|
46
|
+
await autotel.context.with(ctx, () => use(span));
|
|
47
|
+
} catch (error) {
|
|
48
|
+
span.setStatus({ code: autotel.SpanStatusCode.ERROR });
|
|
49
|
+
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
50
|
+
throw error;
|
|
51
|
+
} finally {
|
|
52
|
+
span.end();
|
|
53
|
+
const traceId = span.spanContext().traceId;
|
|
54
|
+
const rootSpanId = span.spanContext().spanId;
|
|
55
|
+
const spans = collector.drainTrace(traceId, rootSpanId);
|
|
56
|
+
if (spans.length > 0) task.meta.otelSpans = spans;
|
|
57
|
+
}
|
|
58
|
+
}, { auto: true }] });
|
|
59
|
+
//#endregion
|
|
59
60
|
Object.defineProperty(exports, "afterAll", {
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function() {
|
|
63
|
+
return vitest.afterAll;
|
|
64
|
+
}
|
|
62
65
|
});
|
|
63
66
|
Object.defineProperty(exports, "afterEach", {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get: function () { return vitest.beforeAll; }
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(exports, "beforeEach", {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function () { return vitest.beforeEach; }
|
|
74
|
-
});
|
|
75
|
-
Object.defineProperty(exports, "describe", {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
get: function () { return vitest.describe; }
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(exports, "expect", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function () { return vitest.expect; }
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(exports, "enrichWithTraceContext", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function () { return autotel.enrichWithTraceContext; }
|
|
86
|
-
});
|
|
87
|
-
Object.defineProperty(exports, "getTraceContext", {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function () { return autotel.getTraceContext; }
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(exports, "isTracing", {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () { return autotel.isTracing; }
|
|
94
|
-
});
|
|
95
|
-
Object.defineProperty(exports, "resolveTraceUrl", {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function () { return autotel.resolveTraceUrl; }
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function() {
|
|
69
|
+
return vitest.afterEach;
|
|
70
|
+
}
|
|
98
71
|
});
|
|
99
72
|
Object.defineProperty(exports, "assertNoErrors", {
|
|
100
|
-
|
|
101
|
-
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function() {
|
|
75
|
+
return autotel_testing.assertNoErrors;
|
|
76
|
+
}
|
|
102
77
|
});
|
|
103
78
|
Object.defineProperty(exports, "assertTraceCreated", {
|
|
104
|
-
|
|
105
|
-
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function() {
|
|
81
|
+
return autotel_testing.assertTraceCreated;
|
|
82
|
+
}
|
|
106
83
|
});
|
|
107
84
|
Object.defineProperty(exports, "assertTraceDuration", {
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function() {
|
|
87
|
+
return autotel_testing.assertTraceDuration;
|
|
88
|
+
}
|
|
110
89
|
});
|
|
111
90
|
Object.defineProperty(exports, "assertTraceFailed", {
|
|
112
|
-
|
|
113
|
-
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function() {
|
|
93
|
+
return autotel_testing.assertTraceFailed;
|
|
94
|
+
}
|
|
114
95
|
});
|
|
115
96
|
Object.defineProperty(exports, "assertTraceSucceeded", {
|
|
116
|
-
|
|
117
|
-
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function() {
|
|
99
|
+
return autotel_testing.assertTraceSucceeded;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "beforeAll", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function() {
|
|
105
|
+
return vitest.beforeAll;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "beforeEach", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function() {
|
|
111
|
+
return vitest.beforeEach;
|
|
112
|
+
}
|
|
118
113
|
});
|
|
119
114
|
Object.defineProperty(exports, "createMockLogger", {
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function() {
|
|
117
|
+
return autotel_testing.createMockLogger;
|
|
118
|
+
}
|
|
122
119
|
});
|
|
123
120
|
Object.defineProperty(exports, "createTraceCollector", {
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return autotel_testing.createTraceCollector;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "describe", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function() {
|
|
129
|
+
return vitest.describe;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "enrichWithTraceContext", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return autotel.enrichWithTraceContext;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "expect", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function() {
|
|
141
|
+
return vitest.expect;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "getTraceContext", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function() {
|
|
147
|
+
return autotel.getTraceContext;
|
|
148
|
+
}
|
|
126
149
|
});
|
|
127
150
|
Object.defineProperty(exports, "getTraceDuration", {
|
|
128
|
-
|
|
129
|
-
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function() {
|
|
153
|
+
return autotel_testing.getTraceDuration;
|
|
154
|
+
}
|
|
130
155
|
});
|
|
131
|
-
Object.defineProperty(exports, "
|
|
132
|
-
|
|
133
|
-
|
|
156
|
+
Object.defineProperty(exports, "isTracing", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function() {
|
|
159
|
+
return autotel.isTracing;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "resolveTraceUrl", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function() {
|
|
165
|
+
return autotel.resolveTraceUrl;
|
|
166
|
+
}
|
|
134
167
|
});
|
|
135
168
|
exports.test = test;
|
|
136
|
-
|
|
169
|
+
Object.defineProperty(exports, "waitForTrace", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
get: function() {
|
|
172
|
+
return autotel_testing.waitForTrace;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
137
176
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["TestSpanCollector","SimpleSpanProcessor","otelTrace","otelContext","SpanStatusCode","base"],"sources":["../src/fixture.ts","../src/index.ts"],"sourcesContent":["import {\n getTracer,\n getAutotelTracerProvider,\n context as otelContext,\n otelTrace,\n SpanStatusCode,\n} from 'autotel';\nimport { TestSpanCollector } from 'autotel/test-span-collector';\nimport { SimpleSpanProcessor } from 'autotel/processors';\n\nconst TRACER_NAME = 'vitest-tests';\nconst TRACER_VERSION = '0.1.0';\n\nlet collector: TestSpanCollector | null = null;\n\ninterface TracerProviderWithProcessor {\n addSpanProcessor(processor: unknown): void;\n}\n\nfunction ensureCollector(): TestSpanCollector {\n if (!collector) {\n collector = new TestSpanCollector();\n const provider = getAutotelTracerProvider();\n if ('addSpanProcessor' in provider) {\n (provider as TracerProviderWithProcessor).addSpanProcessor(\n new SimpleSpanProcessor(collector),\n );\n }\n }\n return collector;\n}\n\nexport type OtelFixtureFn = (\n args: { task: { name: string; file?: { name: string }; suite?: { name: string }; meta: Record<string, unknown> } },\n use: (span: unknown) => Promise<void>,\n) => Promise<void>;\n\nexport const otelTestSpanFixture: [OtelFixtureFn, { auto: true }] = [\n async (\n { task }: { task: { name: string; file?: { name: string }; suite?: { name: string }; meta: Record<string, unknown> } },\n use: (span: unknown) => Promise<void>,\n ) => {\n ensureCollector();\n const tracer = getTracer(TRACER_NAME, TRACER_VERSION);\n const span = tracer.startSpan(`test:${task.name}`, {\n attributes: {\n 'test.name': task.name,\n 'test.file': task.file?.name ?? '',\n 'test.suite': task.suite?.name ?? '',\n },\n });\n const ctx = otelTrace.setSpan(otelContext.active(), span);\n try {\n await otelContext.with(ctx, () => use(span));\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n span.recordException(error instanceof Error ? error : new Error(String(error)));\n throw error;\n } finally {\n span.end();\n const traceId = span.spanContext().traceId;\n const rootSpanId = span.spanContext().spanId;\n const spans = collector!.drainTrace(traceId, rootSpanId);\n if (spans.length > 0) {\n (task.meta as Record<string, unknown>).otelSpans = spans;\n }\n }\n },\n { auto: true },\n];\n","/**\n * autotel-vitest\n *\n * Vitest fixture that creates one OTel span per test so all autotel-instrumented\n * code executed during a test automatically creates child spans under it;\n * making every test run filterable in your OTLP backend.\n *\n * @example\n * // vitest.config.ts: globalSetup calls init({ service: 'unit-tests' })\n * // In spec:\n * import { test, expect } from 'autotel-vitest';\n * test('creates user', async () => {\n * await userService.createUser({ email: 'test@example.com' });\n * // All trace()/span() calls become children of the test span\n * });\n */\n\nimport { test as base } from 'vitest';\nimport { otelTestSpanFixture } from './fixture';\n\nexport const test = base.extend({\n _otelTestSpan: otelTestSpanFixture as never,\n});\n\nexport { expect, describe, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';\n\n// Re-export all autotel/testing utilities\nexport {\n createTraceCollector,\n assertTraceCreated,\n assertTraceSucceeded,\n assertTraceFailed,\n assertNoErrors,\n assertTraceDuration,\n waitForTrace,\n getTraceDuration,\n createMockLogger,\n type TraceCollector,\n type TestSpan,\n type LogCollector,\n type LogEntry,\n} from 'autotel/testing';\n\n// Re-export trace context helpers for DX convenience\nexport {\n getTraceContext,\n resolveTraceUrl,\n isTracing,\n enrichWithTraceContext,\n} from 'autotel';\n\nexport type { OtelTraceContext } from 'autotel';\n"],"mappings":";;;;;;;AAUA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAEvB,IAAI,YAAsC;AAM1C,SAAS,kBAAqC;CAC5C,IAAI,CAAC,WAAW;EACd,YAAY,IAAIA,4BAAAA,kBAAkB;EAClC,MAAM,YAAA,GAAA,QAAA,yBAAA,CAAoC;EAC1C,IAAI,sBAAsB,UACxB,SAA0C,iBACxC,IAAIC,mBAAAA,oBAAoB,SAAS,CACnC;CAEJ;CACA,OAAO;AACT;;;;;;;;;;;;;;;;;;;ACVA,MAAa,OAAOI,OAAAA,KAAK,OAAO,EAC9B,eAAe,CDiBf,OACE,EAAE,QACF,QACG;CACH,gBAAgB;CAEhB,MAAM,QAAA,GAAA,QAAA,UAAA,CADmB,aAAa,cACpB,CAAC,CAAC,UAAU,QAAQ,KAAK,QAAQ,EACjD,YAAY;EACV,aAAa,KAAK;EAClB,aAAa,KAAK,MAAM,QAAQ;EAChC,cAAc,KAAK,OAAO,QAAQ;CACpC,EACF,CAAC;CACD,MAAM,MAAMH,QAAAA,UAAU,QAAQC,QAAAA,QAAY,OAAO,GAAG,IAAI;CACxD,IAAI;EACF,MAAMA,QAAAA,QAAY,KAAK,WAAW,IAAI,IAAI,CAAC;CAC7C,SAAS,OAAO;EACd,KAAK,UAAU,EAAE,MAAMC,QAAAA,eAAe,MAAM,CAAC;EAC7C,KAAK,gBAAgB,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC,CAAC;EAC9E,MAAM;CACR,UAAU;EACR,KAAK,IAAI;EACT,MAAM,UAAU,KAAK,YAAY,CAAC,CAAC;EACnC,MAAM,aAAa,KAAK,YAAY,CAAC,CAAC;EACtC,MAAM,QAAQ,UAAW,WAAW,SAAS,UAAU;EACvD,IAAI,MAAM,SAAS,GACjB,KAAM,KAAiC,YAAY;CAEvD;AACF,GACA,EAAE,MAAM,KAAK,CC/CE,EACjB,CAAC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { OtelTraceContext, enrichWithTraceContext, getTraceContext, isTracing, resolveTraceUrl } from 'autotel';
|
|
1
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect } from "vitest";
|
|
2
|
+
import { LogCollector, LogEntry, TestSpan, TraceCollector, assertNoErrors, assertTraceCreated, assertTraceDuration, assertTraceFailed, assertTraceSucceeded, createMockLogger, createTraceCollector, getTraceDuration, waitForTrace } from "autotel/testing";
|
|
3
|
+
import { OtelTraceContext, enrichWithTraceContext, getTraceContext, isTracing, resolveTraceUrl } from "autotel";
|
|
5
4
|
|
|
5
|
+
//#region src/index.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* autotel-vitest
|
|
8
8
|
*
|
|
@@ -19,6 +19,7 @@ export { OtelTraceContext, enrichWithTraceContext, getTraceContext, isTracing, r
|
|
|
19
19
|
* // All trace()/span() calls become children of the test span
|
|
20
20
|
* });
|
|
21
21
|
*/
|
|
22
|
-
declare const test: vitest.TestAPI<Record<string, any> & object>;
|
|
23
|
-
|
|
24
|
-
export { test };
|
|
22
|
+
declare const test: import("vitest").TestAPI<Record<string, any> & object>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { type LogCollector, type LogEntry, type OtelTraceContext, type TestSpan, type TraceCollector, afterAll, afterEach, assertNoErrors, assertTraceCreated, assertTraceDuration, assertTraceFailed, assertTraceSucceeded, beforeAll, beforeEach, createMockLogger, createTraceCollector, describe, enrichWithTraceContext, expect, getTraceContext, getTraceDuration, isTracing, resolveTraceUrl, test, waitForTrace };
|
|
25
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;AAoBA;;;;AAAiB;;;;;;;cAAJ,IAAA,mBAAI,OAAA,CAAA,MAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { OtelTraceContext, enrichWithTraceContext, getTraceContext, isTracing, resolveTraceUrl } from 'autotel';
|
|
1
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect } from "vitest";
|
|
2
|
+
import { OtelTraceContext, enrichWithTraceContext, getTraceContext, isTracing, resolveTraceUrl } from "autotel";
|
|
3
|
+
import { LogCollector, LogEntry, TestSpan, TraceCollector, assertNoErrors, assertTraceCreated, assertTraceDuration, assertTraceFailed, assertTraceSucceeded, createMockLogger, createTraceCollector, getTraceDuration, waitForTrace } from "autotel/testing";
|
|
5
4
|
|
|
5
|
+
//#region src/index.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* autotel-vitest
|
|
8
8
|
*
|
|
@@ -19,6 +19,7 @@ export { OtelTraceContext, enrichWithTraceContext, getTraceContext, isTracing, r
|
|
|
19
19
|
* // All trace()/span() calls become children of the test span
|
|
20
20
|
* });
|
|
21
21
|
*/
|
|
22
|
-
declare const test: vitest.TestAPI<Record<string, any> & object>;
|
|
23
|
-
|
|
24
|
-
export { test };
|
|
22
|
+
declare const test: import("vitest").TestAPI<Record<string, any> & object>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { type LogCollector, type LogEntry, type OtelTraceContext, type TestSpan, type TraceCollector, afterAll, afterEach, assertNoErrors, assertTraceCreated, assertTraceDuration, assertTraceFailed, assertTraceSucceeded, beforeAll, beforeEach, createMockLogger, createTraceCollector, describe, enrichWithTraceContext, expect, getTraceContext, getTraceDuration, isTracing, resolveTraceUrl, test, waitForTrace };
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;AAoBA;;;;AAAiB;;;;;;;cAAJ,IAAA,mBAAI,OAAA,CAAA,MAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { test as test$1 } from
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var TRACER_NAME = "vitest-tests";
|
|
11
|
-
var TRACER_VERSION = "0.1.0";
|
|
12
|
-
var collector = null;
|
|
1
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test as test$1 } from "vitest";
|
|
2
|
+
import { SpanStatusCode, context, enrichWithTraceContext, getAutotelTracerProvider, getTraceContext, getTracer, isTracing, otelTrace, resolveTraceUrl } from "autotel";
|
|
3
|
+
import { TestSpanCollector } from "autotel/test-span-collector";
|
|
4
|
+
import { SimpleSpanProcessor } from "autotel/processors";
|
|
5
|
+
import { assertNoErrors, assertTraceCreated, assertTraceDuration, assertTraceFailed, assertTraceSucceeded, createMockLogger, createTraceCollector, getTraceDuration, waitForTrace } from "autotel/testing";
|
|
6
|
+
//#region src/fixture.ts
|
|
7
|
+
const TRACER_NAME = "vitest-tests";
|
|
8
|
+
const TRACER_VERSION = "0.1.0";
|
|
9
|
+
let collector = null;
|
|
13
10
|
function ensureCollector() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return collector;
|
|
11
|
+
if (!collector) {
|
|
12
|
+
collector = new TestSpanCollector();
|
|
13
|
+
const provider = getAutotelTracerProvider();
|
|
14
|
+
if ("addSpanProcessor" in provider) provider.addSpanProcessor(new SimpleSpanProcessor(collector));
|
|
15
|
+
}
|
|
16
|
+
return collector;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.ts
|
|
20
|
+
/**
|
|
21
|
+
* autotel-vitest
|
|
22
|
+
*
|
|
23
|
+
* Vitest fixture that creates one OTel span per test so all autotel-instrumented
|
|
24
|
+
* code executed during a test automatically creates child spans under it;
|
|
25
|
+
* making every test run filterable in your OTLP backend.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // vitest.config.ts: globalSetup calls init({ service: 'unit-tests' })
|
|
29
|
+
* // In spec:
|
|
30
|
+
* import { test, expect } from 'autotel-vitest';
|
|
31
|
+
* test('creates user', async () => {
|
|
32
|
+
* await userService.createUser({ email: 'test@example.com' });
|
|
33
|
+
* // All trace()/span() calls become children of the test span
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
36
|
+
const test = test$1.extend({ _otelTestSpan: [async ({ task }, use) => {
|
|
37
|
+
ensureCollector();
|
|
38
|
+
const span = getTracer(TRACER_NAME, TRACER_VERSION).startSpan(`test:${task.name}`, { attributes: {
|
|
39
|
+
"test.name": task.name,
|
|
40
|
+
"test.file": task.file?.name ?? "",
|
|
41
|
+
"test.suite": task.suite?.name ?? ""
|
|
42
|
+
} });
|
|
43
|
+
const ctx = otelTrace.setSpan(context.active(), span);
|
|
44
|
+
try {
|
|
45
|
+
await context.with(ctx, () => use(span));
|
|
46
|
+
} catch (error) {
|
|
47
|
+
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
48
|
+
span.recordException(error instanceof Error ? error : new Error(String(error)));
|
|
49
|
+
throw error;
|
|
50
|
+
} finally {
|
|
51
|
+
span.end();
|
|
52
|
+
const traceId = span.spanContext().traceId;
|
|
53
|
+
const rootSpanId = span.spanContext().spanId;
|
|
54
|
+
const spans = collector.drainTrace(traceId, rootSpanId);
|
|
55
|
+
if (spans.length > 0) task.meta.otelSpans = spans;
|
|
56
|
+
}
|
|
57
|
+
}, { auto: true }] });
|
|
58
|
+
//#endregion
|
|
59
|
+
export { afterAll, afterEach, assertNoErrors, assertTraceCreated, assertTraceDuration, assertTraceFailed, assertTraceSucceeded, beforeAll, beforeEach, createMockLogger, createTraceCollector, describe, enrichWithTraceContext, expect, getTraceContext, getTraceDuration, isTracing, resolveTraceUrl, test, waitForTrace };
|
|
58
60
|
|
|
59
|
-
export { test };
|
|
60
|
-
//# sourceMappingURL=index.js.map
|
|
61
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["otelContext","base"],"sources":["../src/fixture.ts","../src/index.ts"],"sourcesContent":["import {\n getTracer,\n getAutotelTracerProvider,\n context as otelContext,\n otelTrace,\n SpanStatusCode,\n} from 'autotel';\nimport { TestSpanCollector } from 'autotel/test-span-collector';\nimport { SimpleSpanProcessor } from 'autotel/processors';\n\nconst TRACER_NAME = 'vitest-tests';\nconst TRACER_VERSION = '0.1.0';\n\nlet collector: TestSpanCollector | null = null;\n\ninterface TracerProviderWithProcessor {\n addSpanProcessor(processor: unknown): void;\n}\n\nfunction ensureCollector(): TestSpanCollector {\n if (!collector) {\n collector = new TestSpanCollector();\n const provider = getAutotelTracerProvider();\n if ('addSpanProcessor' in provider) {\n (provider as TracerProviderWithProcessor).addSpanProcessor(\n new SimpleSpanProcessor(collector),\n );\n }\n }\n return collector;\n}\n\nexport type OtelFixtureFn = (\n args: { task: { name: string; file?: { name: string }; suite?: { name: string }; meta: Record<string, unknown> } },\n use: (span: unknown) => Promise<void>,\n) => Promise<void>;\n\nexport const otelTestSpanFixture: [OtelFixtureFn, { auto: true }] = [\n async (\n { task }: { task: { name: string; file?: { name: string }; suite?: { name: string }; meta: Record<string, unknown> } },\n use: (span: unknown) => Promise<void>,\n ) => {\n ensureCollector();\n const tracer = getTracer(TRACER_NAME, TRACER_VERSION);\n const span = tracer.startSpan(`test:${task.name}`, {\n attributes: {\n 'test.name': task.name,\n 'test.file': task.file?.name ?? '',\n 'test.suite': task.suite?.name ?? '',\n },\n });\n const ctx = otelTrace.setSpan(otelContext.active(), span);\n try {\n await otelContext.with(ctx, () => use(span));\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n span.recordException(error instanceof Error ? error : new Error(String(error)));\n throw error;\n } finally {\n span.end();\n const traceId = span.spanContext().traceId;\n const rootSpanId = span.spanContext().spanId;\n const spans = collector!.drainTrace(traceId, rootSpanId);\n if (spans.length > 0) {\n (task.meta as Record<string, unknown>).otelSpans = spans;\n }\n }\n },\n { auto: true },\n];\n","/**\n * autotel-vitest\n *\n * Vitest fixture that creates one OTel span per test so all autotel-instrumented\n * code executed during a test automatically creates child spans under it;\n * making every test run filterable in your OTLP backend.\n *\n * @example\n * // vitest.config.ts: globalSetup calls init({ service: 'unit-tests' })\n * // In spec:\n * import { test, expect } from 'autotel-vitest';\n * test('creates user', async () => {\n * await userService.createUser({ email: 'test@example.com' });\n * // All trace()/span() calls become children of the test span\n * });\n */\n\nimport { test as base } from 'vitest';\nimport { otelTestSpanFixture } from './fixture';\n\nexport const test = base.extend({\n _otelTestSpan: otelTestSpanFixture as never,\n});\n\nexport { expect, describe, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';\n\n// Re-export all autotel/testing utilities\nexport {\n createTraceCollector,\n assertTraceCreated,\n assertTraceSucceeded,\n assertTraceFailed,\n assertNoErrors,\n assertTraceDuration,\n waitForTrace,\n getTraceDuration,\n createMockLogger,\n type TraceCollector,\n type TestSpan,\n type LogCollector,\n type LogEntry,\n} from 'autotel/testing';\n\n// Re-export trace context helpers for DX convenience\nexport {\n getTraceContext,\n resolveTraceUrl,\n isTracing,\n enrichWithTraceContext,\n} from 'autotel';\n\nexport type { OtelTraceContext } from 'autotel';\n"],"mappings":";;;;;;AAUA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAEvB,IAAI,YAAsC;AAM1C,SAAS,kBAAqC;CAC5C,IAAI,CAAC,WAAW;EACd,YAAY,IAAI,kBAAkB;EAClC,MAAM,WAAW,yBAAyB;EAC1C,IAAI,sBAAsB,UACxB,SAA0C,iBACxC,IAAI,oBAAoB,SAAS,CACnC;CAEJ;CACA,OAAO;AACT;;;;;;;;;;;;;;;;;;;ACVA,MAAa,OAAOC,OAAK,OAAO,EAC9B,eAAe,CDiBf,OACE,EAAE,QACF,QACG;CACH,gBAAgB;CAEhB,MAAM,OADS,UAAU,aAAa,cACpB,CAAC,CAAC,UAAU,QAAQ,KAAK,QAAQ,EACjD,YAAY;EACV,aAAa,KAAK;EAClB,aAAa,KAAK,MAAM,QAAQ;EAChC,cAAc,KAAK,OAAO,QAAQ;CACpC,EACF,CAAC;CACD,MAAM,MAAM,UAAU,QAAQD,QAAY,OAAO,GAAG,IAAI;CACxD,IAAI;EACF,MAAMA,QAAY,KAAK,WAAW,IAAI,IAAI,CAAC;CAC7C,SAAS,OAAO;EACd,KAAK,UAAU,EAAE,MAAM,eAAe,MAAM,CAAC;EAC7C,KAAK,gBAAgB,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC,CAAC;EAC9E,MAAM;CACR,UAAU;EACR,KAAK,IAAI;EACT,MAAM,UAAU,KAAK,YAAY,CAAC,CAAC;EACnC,MAAM,aAAa,KAAK,YAAY,CAAC,CAAC;EACtC,MAAM,QAAQ,UAAW,WAAW,SAAS,UAAU;EACvD,IAAI,MAAM,SAAS,GACjB,KAAM,KAAiC,YAAY;CAEvD;AACF,GACA,EAAE,MAAM,KAAK,CC/CE,EACjB,CAAC"}
|
package/dist/reporter.cjs
CHANGED
|
@@ -1,87 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
let autotel = require("autotel");
|
|
6
|
+
//#region src/reporter.ts
|
|
7
|
+
const TRACER_NAME = "vitest-reporter";
|
|
8
|
+
const TRACER_VERSION = "0.1.0";
|
|
9
|
+
/** Convert a vitest TestError-like object to a standard Error for OTel. */
|
|
10
10
|
function toError(testError) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const err = new Error(testError.message ?? "Unknown error");
|
|
12
|
+
if (testError.stack) err.stack = testError.stack;
|
|
13
|
+
return err;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Vitest Reporter that creates one span per test and one per suite (as parents).
|
|
17
|
+
* Requires autotel.init() in globalSetup so spans are exported.
|
|
18
|
+
*/
|
|
15
19
|
var OtelReporter = class {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
for (const [key, entry] of this.suiteSpans) {
|
|
75
|
-
if (entry.moduleId === moduleId) {
|
|
76
|
-
entry.span.end();
|
|
77
|
-
this.suiteSpans.delete(key);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
20
|
+
testSpans = /* @__PURE__ */ new Map();
|
|
21
|
+
suiteSpans = /* @__PURE__ */ new Map();
|
|
22
|
+
onTestCaseReady(testCase) {
|
|
23
|
+
const tracer = (0, autotel.getTracer)(TRACER_NAME, TRACER_VERSION);
|
|
24
|
+
const moduleId = testCase.module.moduleId ?? "";
|
|
25
|
+
const span = tracer.startSpan(`test:${testCase.name}`, { attributes: {
|
|
26
|
+
"test.name": testCase.name,
|
|
27
|
+
"test.fullName": testCase.fullName,
|
|
28
|
+
"test.file": moduleId
|
|
29
|
+
} });
|
|
30
|
+
this.testSpans.set(testCase.id, {
|
|
31
|
+
span,
|
|
32
|
+
moduleId
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
onTestCaseResult(testCase) {
|
|
36
|
+
const entry = this.testSpans.get(testCase.id);
|
|
37
|
+
if (!entry) return;
|
|
38
|
+
const result = testCase.result();
|
|
39
|
+
if (result.state === "failed") {
|
|
40
|
+
entry.span.setStatus({ code: autotel.SpanStatusCode.ERROR });
|
|
41
|
+
if (result.errors && result.errors.length > 0) for (const error of result.errors) entry.span.recordException(toError(error));
|
|
42
|
+
}
|
|
43
|
+
entry.span.end();
|
|
44
|
+
this.testSpans.delete(testCase.id);
|
|
45
|
+
}
|
|
46
|
+
onTestSuiteReady(testSuite) {
|
|
47
|
+
const tracer = (0, autotel.getTracer)(TRACER_NAME, TRACER_VERSION);
|
|
48
|
+
const moduleId = testSuite.module.moduleId ?? "";
|
|
49
|
+
const span = tracer.startSpan(`suite:${testSuite.name}`, { attributes: {
|
|
50
|
+
"suite.name": testSuite.name,
|
|
51
|
+
"suite.file": moduleId
|
|
52
|
+
} });
|
|
53
|
+
this.suiteSpans.set(testSuite.id, {
|
|
54
|
+
span,
|
|
55
|
+
moduleId
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
onTestSuiteResult(testSuite) {
|
|
59
|
+
const entry = this.suiteSpans.get(testSuite.id);
|
|
60
|
+
if (!entry) return;
|
|
61
|
+
if (testSuite.state() === "failed") entry.span.setStatus({ code: autotel.SpanStatusCode.ERROR });
|
|
62
|
+
entry.span.end();
|
|
63
|
+
this.suiteSpans.delete(testSuite.id);
|
|
64
|
+
}
|
|
65
|
+
onTestModuleEnd(testModule) {
|
|
66
|
+
const moduleId = testModule.moduleId;
|
|
67
|
+
for (const [key, entry] of this.testSpans) if (entry.moduleId === moduleId) {
|
|
68
|
+
entry.span.end();
|
|
69
|
+
this.testSpans.delete(key);
|
|
70
|
+
}
|
|
71
|
+
for (const [key, entry] of this.suiteSpans) if (entry.moduleId === moduleId) {
|
|
72
|
+
entry.span.end();
|
|
73
|
+
this.suiteSpans.delete(key);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
81
76
|
};
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
//#endregion
|
|
84
78
|
exports.OtelReporter = OtelReporter;
|
|
85
|
-
exports.default =
|
|
86
|
-
|
|
79
|
+
exports.default = OtelReporter;
|
|
80
|
+
|
|
87
81
|
//# sourceMappingURL=reporter.cjs.map
|
package/dist/reporter.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"reporter.cjs","names":["SpanStatusCode"],"sources":["../src/reporter.ts"],"sourcesContent":["/**\n * Optional Vitest reporter that creates OTel spans for each test and suite.\n * Runs in the runner process; ensure autotel.init() is called in globalSetup so spans are exported.\n *\n * Use when you want test/suite timing and hierarchy in OTLP from the runner side.\n * For \"test → instrumented code\" in one trace (worker side), use the test fixture.\n *\n * @example\n * // vitest.config.ts\n * import { defineConfig } from 'vitest/config';\n *\n * export default defineConfig({\n * test: {\n * reporters: ['default', 'autotel-vitest/reporter'],\n * globalSetup: './globalSetup.ts', // must call init()\n * },\n * });\n */\n\nimport type { Reporter, TestCase, TestModule, TestSuite } from 'vitest/node';\nimport { getTracer, SpanStatusCode } from 'autotel';\n\nconst TRACER_NAME = 'vitest-reporter';\nconst TRACER_VERSION = '0.1.0';\n\ntype SpanEntry = {\n span: ReturnType<ReturnType<typeof getTracer>['startSpan']>;\n moduleId: string;\n};\n\n/** Convert a vitest TestError-like object to a standard Error for OTel. */\nfunction toError(testError: { message?: string; stack?: string }): Error {\n const err = new Error(testError.message ?? 'Unknown error');\n if (testError.stack) err.stack = testError.stack;\n return err;\n}\n\n/**\n * Vitest Reporter that creates one span per test and one per suite (as parents).\n * Requires autotel.init() in globalSetup so spans are exported.\n */\nclass OtelReporter implements Reporter {\n private testSpans = new Map<string, SpanEntry>();\n private suiteSpans = new Map<string, SpanEntry>();\n\n onTestCaseReady(testCase: TestCase): void {\n const tracer = getTracer(TRACER_NAME, TRACER_VERSION);\n const moduleId = testCase.module.moduleId ?? '';\n const span = tracer.startSpan(`test:${testCase.name}`, {\n attributes: {\n 'test.name': testCase.name,\n 'test.fullName': testCase.fullName,\n 'test.file': moduleId,\n },\n });\n this.testSpans.set(testCase.id, { span, moduleId });\n }\n\n onTestCaseResult(testCase: TestCase): void {\n const entry = this.testSpans.get(testCase.id);\n if (!entry) return;\n\n const result = testCase.result();\n if (result.state === 'failed') {\n entry.span.setStatus({ code: SpanStatusCode.ERROR });\n if (result.errors && result.errors.length > 0) {\n for (const error of result.errors) {\n entry.span.recordException(toError(error));\n }\n }\n }\n entry.span.end();\n this.testSpans.delete(testCase.id);\n }\n\n onTestSuiteReady(testSuite: TestSuite): void {\n const tracer = getTracer(TRACER_NAME, TRACER_VERSION);\n const moduleId = testSuite.module.moduleId ?? '';\n const span = tracer.startSpan(`suite:${testSuite.name}`, {\n attributes: {\n 'suite.name': testSuite.name,\n 'suite.file': moduleId,\n },\n });\n this.suiteSpans.set(testSuite.id, { span, moduleId });\n }\n\n onTestSuiteResult(testSuite: TestSuite): void {\n const entry = this.suiteSpans.get(testSuite.id);\n if (!entry) return;\n\n const state = testSuite.state();\n if (state === 'failed') {\n entry.span.setStatus({ code: SpanStatusCode.ERROR });\n }\n entry.span.end();\n this.suiteSpans.delete(testSuite.id);\n }\n\n onTestModuleEnd(testModule: TestModule): void {\n const moduleId = testModule.moduleId;\n // Clean up any remaining spans for this specific module\n for (const [key, entry] of this.testSpans) {\n if (entry.moduleId === moduleId) {\n entry.span.end();\n this.testSpans.delete(key);\n }\n }\n for (const [key, entry] of this.suiteSpans) {\n if (entry.moduleId === moduleId) {\n entry.span.end();\n this.suiteSpans.delete(key);\n }\n }\n }\n}\n\nexport { OtelReporter };\nexport default OtelReporter;\n"],"mappings":";;;;;;AAsBA,MAAM,cAAc;AACpB,MAAM,iBAAiB;;AAQvB,SAAS,QAAQ,WAAwD;CACvE,MAAM,MAAM,IAAI,MAAM,UAAU,WAAW,eAAe;CAC1D,IAAI,UAAU,OAAO,IAAI,QAAQ,UAAU;CAC3C,OAAO;AACT;;;;;AAMA,IAAM,eAAN,MAAuC;CACrC,4BAAoB,IAAI,IAAuB;CAC/C,6BAAqB,IAAI,IAAuB;CAEhD,gBAAgB,UAA0B;EACxC,MAAM,UAAA,GAAA,QAAA,UAAA,CAAmB,aAAa,cAAc;EACpD,MAAM,WAAW,SAAS,OAAO,YAAY;EAC7C,MAAM,OAAO,OAAO,UAAU,QAAQ,SAAS,QAAQ,EACrD,YAAY;GACV,aAAa,SAAS;GACtB,iBAAiB,SAAS;GAC1B,aAAa;EACf,EACF,CAAC;EACD,KAAK,UAAU,IAAI,SAAS,IAAI;GAAE;GAAM;EAAS,CAAC;CACpD;CAEA,iBAAiB,UAA0B;EACzC,MAAM,QAAQ,KAAK,UAAU,IAAI,SAAS,EAAE;EAC5C,IAAI,CAAC,OAAO;EAEZ,MAAM,SAAS,SAAS,OAAO;EAC/B,IAAI,OAAO,UAAU,UAAU;GAC7B,MAAM,KAAK,UAAU,EAAE,MAAMA,QAAAA,eAAe,MAAM,CAAC;GACnD,IAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAC1C,KAAK,MAAM,SAAS,OAAO,QACzB,MAAM,KAAK,gBAAgB,QAAQ,KAAK,CAAC;EAG/C;EACA,MAAM,KAAK,IAAI;EACf,KAAK,UAAU,OAAO,SAAS,EAAE;CACnC;CAEA,iBAAiB,WAA4B;EAC3C,MAAM,UAAA,GAAA,QAAA,UAAA,CAAmB,aAAa,cAAc;EACpD,MAAM,WAAW,UAAU,OAAO,YAAY;EAC9C,MAAM,OAAO,OAAO,UAAU,SAAS,UAAU,QAAQ,EACvD,YAAY;GACV,cAAc,UAAU;GACxB,cAAc;EAChB,EACF,CAAC;EACD,KAAK,WAAW,IAAI,UAAU,IAAI;GAAE;GAAM;EAAS,CAAC;CACtD;CAEA,kBAAkB,WAA4B;EAC5C,MAAM,QAAQ,KAAK,WAAW,IAAI,UAAU,EAAE;EAC9C,IAAI,CAAC,OAAO;EAGZ,IADc,UAAU,MAChB,MAAM,UACZ,MAAM,KAAK,UAAU,EAAE,MAAMA,QAAAA,eAAe,MAAM,CAAC;EAErD,MAAM,KAAK,IAAI;EACf,KAAK,WAAW,OAAO,UAAU,EAAE;CACrC;CAEA,gBAAgB,YAA8B;EAC5C,MAAM,WAAW,WAAW;EAE5B,KAAK,MAAM,CAAC,KAAK,UAAU,KAAK,WAC9B,IAAI,MAAM,aAAa,UAAU;GAC/B,MAAM,KAAK,IAAI;GACf,KAAK,UAAU,OAAO,GAAG;EAC3B;EAEF,KAAK,MAAM,CAAC,KAAK,UAAU,KAAK,YAC9B,IAAI,MAAM,aAAa,UAAU;GAC/B,MAAM,KAAK,IAAI;GACf,KAAK,WAAW,OAAO,GAAG;EAC5B;CAEJ;AACF"}
|
package/dist/reporter.d.cts
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
import { Reporter, TestCase,
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Optional Vitest reporter that creates OTel spans for each test and suite.
|
|
5
|
-
* Runs in the runner process; ensure autotel.init() is called in globalSetup so spans are exported.
|
|
6
|
-
*
|
|
7
|
-
* Use when you want test/suite timing and hierarchy in OTLP from the runner side.
|
|
8
|
-
* For "test → instrumented code" in one trace (worker side), use the test fixture.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // vitest.config.ts
|
|
12
|
-
* import { defineConfig } from 'vitest/config';
|
|
13
|
-
*
|
|
14
|
-
* export default defineConfig({
|
|
15
|
-
* test: {
|
|
16
|
-
* reporters: ['default', 'autotel-vitest/reporter'],
|
|
17
|
-
* globalSetup: './globalSetup.ts', // must call init()
|
|
18
|
-
* },
|
|
19
|
-
* });
|
|
20
|
-
*/
|
|
1
|
+
import { Reporter, TestCase, TestModule, TestSuite } from "vitest/node";
|
|
21
2
|
|
|
3
|
+
//#region src/reporter.d.ts
|
|
22
4
|
/**
|
|
23
5
|
* Vitest Reporter that creates one span per test and one per suite (as parents).
|
|
24
6
|
* Requires autotel.init() in globalSetup so spans are exported.
|
|
25
7
|
*/
|
|
26
8
|
declare class OtelReporter implements Reporter {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
private testSpans;
|
|
10
|
+
private suiteSpans;
|
|
11
|
+
onTestCaseReady(testCase: TestCase): void;
|
|
12
|
+
onTestCaseResult(testCase: TestCase): void;
|
|
13
|
+
onTestSuiteReady(testSuite: TestSuite): void;
|
|
14
|
+
onTestSuiteResult(testSuite: TestSuite): void;
|
|
15
|
+
onTestModuleEnd(testModule: TestModule): void;
|
|
34
16
|
}
|
|
35
|
-
|
|
17
|
+
//#endregion
|
|
36
18
|
export { OtelReporter, OtelReporter as default };
|
|
19
|
+
//# sourceMappingURL=reporter.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.cts","names":[],"sources":["../src/reporter.ts"],"mappings":";;;;;;;cAyCM,YAAA,YAAwB,QAAA;EAAA,QACpB,SAAA;EAAA,QACA,UAAA;EAER,eAAA,CAAgB,QAAA,EAAU,QAAA;EAa1B,gBAAA,CAAiB,QAAA,EAAU,QAAA;EAiB3B,gBAAA,CAAiB,SAAA,EAAW,SAAA;EAY5B,iBAAA,CAAkB,SAAA,EAAW,SAAA;EAY7B,eAAA,CAAgB,UAAA,EAAY,UAAA;AAAA"}
|
package/dist/reporter.d.ts
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
|
-
import { Reporter, TestCase,
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Optional Vitest reporter that creates OTel spans for each test and suite.
|
|
5
|
-
* Runs in the runner process; ensure autotel.init() is called in globalSetup so spans are exported.
|
|
6
|
-
*
|
|
7
|
-
* Use when you want test/suite timing and hierarchy in OTLP from the runner side.
|
|
8
|
-
* For "test → instrumented code" in one trace (worker side), use the test fixture.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* // vitest.config.ts
|
|
12
|
-
* import { defineConfig } from 'vitest/config';
|
|
13
|
-
*
|
|
14
|
-
* export default defineConfig({
|
|
15
|
-
* test: {
|
|
16
|
-
* reporters: ['default', 'autotel-vitest/reporter'],
|
|
17
|
-
* globalSetup: './globalSetup.ts', // must call init()
|
|
18
|
-
* },
|
|
19
|
-
* });
|
|
20
|
-
*/
|
|
1
|
+
import { Reporter, TestCase, TestModule, TestSuite } from "vitest/node";
|
|
21
2
|
|
|
3
|
+
//#region src/reporter.d.ts
|
|
22
4
|
/**
|
|
23
5
|
* Vitest Reporter that creates one span per test and one per suite (as parents).
|
|
24
6
|
* Requires autotel.init() in globalSetup so spans are exported.
|
|
25
7
|
*/
|
|
26
8
|
declare class OtelReporter implements Reporter {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
private testSpans;
|
|
10
|
+
private suiteSpans;
|
|
11
|
+
onTestCaseReady(testCase: TestCase): void;
|
|
12
|
+
onTestCaseResult(testCase: TestCase): void;
|
|
13
|
+
onTestSuiteReady(testSuite: TestSuite): void;
|
|
14
|
+
onTestSuiteResult(testSuite: TestSuite): void;
|
|
15
|
+
onTestModuleEnd(testModule: TestModule): void;
|
|
34
16
|
}
|
|
35
|
-
|
|
17
|
+
//#endregion
|
|
36
18
|
export { OtelReporter, OtelReporter as default };
|
|
19
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","names":[],"sources":["../src/reporter.ts"],"mappings":";;;;;;;cAyCM,YAAA,YAAwB,QAAA;EAAA,QACpB,SAAA;EAAA,QACA,UAAA;EAER,eAAA,CAAgB,QAAA,EAAU,QAAA;EAa1B,gBAAA,CAAiB,QAAA,EAAU,QAAA;EAiB3B,gBAAA,CAAiB,SAAA,EAAW,SAAA;EAY5B,iBAAA,CAAkB,SAAA,EAAW,SAAA;EAY7B,eAAA,CAAgB,UAAA,EAAY,UAAA;AAAA"}
|
package/dist/reporter.js
CHANGED
|
@@ -1,82 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { SpanStatusCode, getTracer } from "autotel";
|
|
2
|
+
//#region src/reporter.ts
|
|
3
|
+
const TRACER_NAME = "vitest-reporter";
|
|
4
|
+
const TRACER_VERSION = "0.1.0";
|
|
5
|
+
/** Convert a vitest TestError-like object to a standard Error for OTel. */
|
|
6
6
|
function toError(testError) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const err = new Error(testError.message ?? "Unknown error");
|
|
8
|
+
if (testError.stack) err.stack = testError.stack;
|
|
9
|
+
return err;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Vitest Reporter that creates one span per test and one per suite (as parents).
|
|
13
|
+
* Requires autotel.init() in globalSetup so spans are exported.
|
|
14
|
+
*/
|
|
11
15
|
var OtelReporter = class {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
for (const [key, entry] of this.suiteSpans) {
|
|
71
|
-
if (entry.moduleId === moduleId) {
|
|
72
|
-
entry.span.end();
|
|
73
|
-
this.suiteSpans.delete(key);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
16
|
+
testSpans = /* @__PURE__ */ new Map();
|
|
17
|
+
suiteSpans = /* @__PURE__ */ new Map();
|
|
18
|
+
onTestCaseReady(testCase) {
|
|
19
|
+
const tracer = getTracer(TRACER_NAME, TRACER_VERSION);
|
|
20
|
+
const moduleId = testCase.module.moduleId ?? "";
|
|
21
|
+
const span = tracer.startSpan(`test:${testCase.name}`, { attributes: {
|
|
22
|
+
"test.name": testCase.name,
|
|
23
|
+
"test.fullName": testCase.fullName,
|
|
24
|
+
"test.file": moduleId
|
|
25
|
+
} });
|
|
26
|
+
this.testSpans.set(testCase.id, {
|
|
27
|
+
span,
|
|
28
|
+
moduleId
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
onTestCaseResult(testCase) {
|
|
32
|
+
const entry = this.testSpans.get(testCase.id);
|
|
33
|
+
if (!entry) return;
|
|
34
|
+
const result = testCase.result();
|
|
35
|
+
if (result.state === "failed") {
|
|
36
|
+
entry.span.setStatus({ code: SpanStatusCode.ERROR });
|
|
37
|
+
if (result.errors && result.errors.length > 0) for (const error of result.errors) entry.span.recordException(toError(error));
|
|
38
|
+
}
|
|
39
|
+
entry.span.end();
|
|
40
|
+
this.testSpans.delete(testCase.id);
|
|
41
|
+
}
|
|
42
|
+
onTestSuiteReady(testSuite) {
|
|
43
|
+
const tracer = getTracer(TRACER_NAME, TRACER_VERSION);
|
|
44
|
+
const moduleId = testSuite.module.moduleId ?? "";
|
|
45
|
+
const span = tracer.startSpan(`suite:${testSuite.name}`, { attributes: {
|
|
46
|
+
"suite.name": testSuite.name,
|
|
47
|
+
"suite.file": moduleId
|
|
48
|
+
} });
|
|
49
|
+
this.suiteSpans.set(testSuite.id, {
|
|
50
|
+
span,
|
|
51
|
+
moduleId
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
onTestSuiteResult(testSuite) {
|
|
55
|
+
const entry = this.suiteSpans.get(testSuite.id);
|
|
56
|
+
if (!entry) return;
|
|
57
|
+
if (testSuite.state() === "failed") entry.span.setStatus({ code: SpanStatusCode.ERROR });
|
|
58
|
+
entry.span.end();
|
|
59
|
+
this.suiteSpans.delete(testSuite.id);
|
|
60
|
+
}
|
|
61
|
+
onTestModuleEnd(testModule) {
|
|
62
|
+
const moduleId = testModule.moduleId;
|
|
63
|
+
for (const [key, entry] of this.testSpans) if (entry.moduleId === moduleId) {
|
|
64
|
+
entry.span.end();
|
|
65
|
+
this.testSpans.delete(key);
|
|
66
|
+
}
|
|
67
|
+
for (const [key, entry] of this.suiteSpans) if (entry.moduleId === moduleId) {
|
|
68
|
+
entry.span.end();
|
|
69
|
+
this.suiteSpans.delete(key);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
77
72
|
};
|
|
78
|
-
|
|
73
|
+
//#endregion
|
|
74
|
+
export { OtelReporter, OtelReporter as default };
|
|
79
75
|
|
|
80
|
-
export { OtelReporter, reporter_default as default };
|
|
81
|
-
//# sourceMappingURL=reporter.js.map
|
|
82
76
|
//# sourceMappingURL=reporter.js.map
|
package/dist/reporter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"reporter.js","names":[],"sources":["../src/reporter.ts"],"sourcesContent":["/**\n * Optional Vitest reporter that creates OTel spans for each test and suite.\n * Runs in the runner process; ensure autotel.init() is called in globalSetup so spans are exported.\n *\n * Use when you want test/suite timing and hierarchy in OTLP from the runner side.\n * For \"test → instrumented code\" in one trace (worker side), use the test fixture.\n *\n * @example\n * // vitest.config.ts\n * import { defineConfig } from 'vitest/config';\n *\n * export default defineConfig({\n * test: {\n * reporters: ['default', 'autotel-vitest/reporter'],\n * globalSetup: './globalSetup.ts', // must call init()\n * },\n * });\n */\n\nimport type { Reporter, TestCase, TestModule, TestSuite } from 'vitest/node';\nimport { getTracer, SpanStatusCode } from 'autotel';\n\nconst TRACER_NAME = 'vitest-reporter';\nconst TRACER_VERSION = '0.1.0';\n\ntype SpanEntry = {\n span: ReturnType<ReturnType<typeof getTracer>['startSpan']>;\n moduleId: string;\n};\n\n/** Convert a vitest TestError-like object to a standard Error for OTel. */\nfunction toError(testError: { message?: string; stack?: string }): Error {\n const err = new Error(testError.message ?? 'Unknown error');\n if (testError.stack) err.stack = testError.stack;\n return err;\n}\n\n/**\n * Vitest Reporter that creates one span per test and one per suite (as parents).\n * Requires autotel.init() in globalSetup so spans are exported.\n */\nclass OtelReporter implements Reporter {\n private testSpans = new Map<string, SpanEntry>();\n private suiteSpans = new Map<string, SpanEntry>();\n\n onTestCaseReady(testCase: TestCase): void {\n const tracer = getTracer(TRACER_NAME, TRACER_VERSION);\n const moduleId = testCase.module.moduleId ?? '';\n const span = tracer.startSpan(`test:${testCase.name}`, {\n attributes: {\n 'test.name': testCase.name,\n 'test.fullName': testCase.fullName,\n 'test.file': moduleId,\n },\n });\n this.testSpans.set(testCase.id, { span, moduleId });\n }\n\n onTestCaseResult(testCase: TestCase): void {\n const entry = this.testSpans.get(testCase.id);\n if (!entry) return;\n\n const result = testCase.result();\n if (result.state === 'failed') {\n entry.span.setStatus({ code: SpanStatusCode.ERROR });\n if (result.errors && result.errors.length > 0) {\n for (const error of result.errors) {\n entry.span.recordException(toError(error));\n }\n }\n }\n entry.span.end();\n this.testSpans.delete(testCase.id);\n }\n\n onTestSuiteReady(testSuite: TestSuite): void {\n const tracer = getTracer(TRACER_NAME, TRACER_VERSION);\n const moduleId = testSuite.module.moduleId ?? '';\n const span = tracer.startSpan(`suite:${testSuite.name}`, {\n attributes: {\n 'suite.name': testSuite.name,\n 'suite.file': moduleId,\n },\n });\n this.suiteSpans.set(testSuite.id, { span, moduleId });\n }\n\n onTestSuiteResult(testSuite: TestSuite): void {\n const entry = this.suiteSpans.get(testSuite.id);\n if (!entry) return;\n\n const state = testSuite.state();\n if (state === 'failed') {\n entry.span.setStatus({ code: SpanStatusCode.ERROR });\n }\n entry.span.end();\n this.suiteSpans.delete(testSuite.id);\n }\n\n onTestModuleEnd(testModule: TestModule): void {\n const moduleId = testModule.moduleId;\n // Clean up any remaining spans for this specific module\n for (const [key, entry] of this.testSpans) {\n if (entry.moduleId === moduleId) {\n entry.span.end();\n this.testSpans.delete(key);\n }\n }\n for (const [key, entry] of this.suiteSpans) {\n if (entry.moduleId === moduleId) {\n entry.span.end();\n this.suiteSpans.delete(key);\n }\n }\n }\n}\n\nexport { OtelReporter };\nexport default OtelReporter;\n"],"mappings":";;AAsBA,MAAM,cAAc;AACpB,MAAM,iBAAiB;;AAQvB,SAAS,QAAQ,WAAwD;CACvE,MAAM,MAAM,IAAI,MAAM,UAAU,WAAW,eAAe;CAC1D,IAAI,UAAU,OAAO,IAAI,QAAQ,UAAU;CAC3C,OAAO;AACT;;;;;AAMA,IAAM,eAAN,MAAuC;CACrC,4BAAoB,IAAI,IAAuB;CAC/C,6BAAqB,IAAI,IAAuB;CAEhD,gBAAgB,UAA0B;EACxC,MAAM,SAAS,UAAU,aAAa,cAAc;EACpD,MAAM,WAAW,SAAS,OAAO,YAAY;EAC7C,MAAM,OAAO,OAAO,UAAU,QAAQ,SAAS,QAAQ,EACrD,YAAY;GACV,aAAa,SAAS;GACtB,iBAAiB,SAAS;GAC1B,aAAa;EACf,EACF,CAAC;EACD,KAAK,UAAU,IAAI,SAAS,IAAI;GAAE;GAAM;EAAS,CAAC;CACpD;CAEA,iBAAiB,UAA0B;EACzC,MAAM,QAAQ,KAAK,UAAU,IAAI,SAAS,EAAE;EAC5C,IAAI,CAAC,OAAO;EAEZ,MAAM,SAAS,SAAS,OAAO;EAC/B,IAAI,OAAO,UAAU,UAAU;GAC7B,MAAM,KAAK,UAAU,EAAE,MAAM,eAAe,MAAM,CAAC;GACnD,IAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAC1C,KAAK,MAAM,SAAS,OAAO,QACzB,MAAM,KAAK,gBAAgB,QAAQ,KAAK,CAAC;EAG/C;EACA,MAAM,KAAK,IAAI;EACf,KAAK,UAAU,OAAO,SAAS,EAAE;CACnC;CAEA,iBAAiB,WAA4B;EAC3C,MAAM,SAAS,UAAU,aAAa,cAAc;EACpD,MAAM,WAAW,UAAU,OAAO,YAAY;EAC9C,MAAM,OAAO,OAAO,UAAU,SAAS,UAAU,QAAQ,EACvD,YAAY;GACV,cAAc,UAAU;GACxB,cAAc;EAChB,EACF,CAAC;EACD,KAAK,WAAW,IAAI,UAAU,IAAI;GAAE;GAAM;EAAS,CAAC;CACtD;CAEA,kBAAkB,WAA4B;EAC5C,MAAM,QAAQ,KAAK,WAAW,IAAI,UAAU,EAAE;EAC9C,IAAI,CAAC,OAAO;EAGZ,IADc,UAAU,MAChB,MAAM,UACZ,MAAM,KAAK,UAAU,EAAE,MAAM,eAAe,MAAM,CAAC;EAErD,MAAM,KAAK,IAAI;EACf,KAAK,WAAW,OAAO,UAAU,EAAE;CACrC;CAEA,gBAAgB,YAA8B;EAC5C,MAAM,WAAW,WAAW;EAE5B,KAAK,MAAM,CAAC,KAAK,UAAU,KAAK,WAC9B,IAAI,MAAM,aAAa,UAAU;GAC/B,MAAM,KAAK,IAAI;GACf,KAAK,UAAU,OAAO,GAAG;EAC3B;EAEF,KAAK,MAAM,CAAC,KAAK,UAAU,KAAK,YAC9B,IAAI,MAAM,aAAa,UAAU;GAC/B,MAAM,KAAK,IAAI;GACf,KAAK,WAAW,OAAO,GAAG;EAC5B;CAEJ;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-vitest",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.31",
|
|
4
4
|
"description": "Vitest fixture for OpenTelemetry: one span per test so all instrumented code is filterable by test run",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"autotel": "
|
|
28
|
+
"autotel": "4.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"vitest": ">=4.1.8"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^25.9.2",
|
|
40
|
-
"
|
|
40
|
+
"tsdown": "^0.22.2",
|
|
41
41
|
"typescript": "^6.0.3",
|
|
42
42
|
"vitest": "^4.1.7"
|
|
43
43
|
},
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"directory": "packages/autotel-vitest"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"build": "
|
|
51
|
-
"dev": "
|
|
50
|
+
"build": "tsdown",
|
|
51
|
+
"dev": "tsdown --watch",
|
|
52
52
|
"type-check": "tsc --noEmit",
|
|
53
53
|
"test": "vitest run",
|
|
54
54
|
"test:compat": "vitest run --config integration/vitest.config.ts",
|