supercov 0.0.9 → 0.0.12
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/README.md +28 -23
- package/bin/native.js +87 -0
- package/bin/supercov.js +10 -4
- package/package.json +39 -25
- package/{dist → runtime/javascript}/atomic.js +0 -1
- package/{dist → runtime/javascript}/launchSupervisor.js +3 -1
- package/{dist → runtime/javascript}/nodeAssert.js +0 -1
- package/{dist → runtime/javascript}/nodeAssertAdapter.js +0 -1
- package/{dist → runtime/javascript}/nodeAssertStrict.js +0 -1
- package/{dist → runtime/javascript}/nodeTest.js +13 -5
- package/{dist → runtime/javascript}/playwright.js +177 -90
- package/{dist → runtime/javascript}/playwrightReporter.js +0 -1
- package/{dist → runtime/javascript}/provenance.js +0 -1
- package/{dist → runtime/javascript}/register.mjs +52 -1
- package/{dist → runtime/javascript}/resolve-loader.mjs +0 -36
- package/{dist → runtime/javascript}/runnerEvidence.js +6 -5
- package/{dist → runtime/javascript}/runtime.js +308 -27
- package/{dist → runtime/javascript}/transport.js +2 -3
- package/{dist → runtime/javascript}/vitest.js +38 -8
- package/{dist → runtime/javascript}/vitestReporter.js +0 -1
- package/dist/agentJson.d.ts +0 -44
- package/dist/agentJson.d.ts.map +0 -1
- package/dist/agentJson.js +0 -84
- package/dist/agentJson.js.map +0 -1
- package/dist/analyze.d.ts +0 -12
- package/dist/analyze.d.ts.map +0 -1
- package/dist/analyze.js +0 -699
- package/dist/analyze.js.map +0 -1
- package/dist/atomic.d.ts +0 -6
- package/dist/atomic.d.ts.map +0 -1
- package/dist/atomic.js.map +0 -1
- package/dist/buildCache.d.ts +0 -14
- package/dist/buildCache.d.ts.map +0 -1
- package/dist/buildCache.js +0 -84
- package/dist/buildCache.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -706
- package/dist/cli.js.map +0 -1
- package/dist/directInstrumenter.d.ts +0 -8
- package/dist/directInstrumenter.d.ts.map +0 -1
- package/dist/directInstrumenter.js +0 -92
- package/dist/directInstrumenter.js.map +0 -1
- package/dist/esmInterceptor.d.ts +0 -6
- package/dist/esmInterceptor.d.ts.map +0 -1
- package/dist/esmInterceptor.js +0 -63
- package/dist/esmInterceptor.js.map +0 -1
- package/dist/evidenceArchive.d.ts +0 -37
- package/dist/evidenceArchive.d.ts.map +0 -1
- package/dist/evidenceArchive.js +0 -110
- package/dist/evidenceArchive.js.map +0 -1
- package/dist/instrumenter.d.ts +0 -11
- package/dist/instrumenter.d.ts.map +0 -1
- package/dist/instrumenter.js +0 -1246
- package/dist/instrumenter.js.map +0 -1
- package/dist/integrity.d.ts +0 -10
- package/dist/integrity.d.ts.map +0 -1
- package/dist/integrity.js +0 -205
- package/dist/integrity.js.map +0 -1
- package/dist/launchSupervisor.d.ts +0 -38
- package/dist/launchSupervisor.d.ts.map +0 -1
- package/dist/launchSupervisor.js.map +0 -1
- package/dist/merge.d.ts +0 -2
- package/dist/merge.d.ts.map +0 -1
- package/dist/merge.js +0 -116
- package/dist/merge.js.map +0 -1
- package/dist/nodeAssert.d.ts +0 -31
- package/dist/nodeAssert.d.ts.map +0 -1
- package/dist/nodeAssert.js.map +0 -1
- package/dist/nodeAssertAdapter.d.ts +0 -6
- package/dist/nodeAssertAdapter.d.ts.map +0 -1
- package/dist/nodeAssertAdapter.js.map +0 -1
- package/dist/nodeAssertStrict.d.ts +0 -31
- package/dist/nodeAssertStrict.d.ts.map +0 -1
- package/dist/nodeAssertStrict.js.map +0 -1
- package/dist/nodeAssertionInstrumenter.d.ts +0 -8
- package/dist/nodeAssertionInstrumenter.d.ts.map +0 -1
- package/dist/nodeAssertionInstrumenter.js +0 -263
- package/dist/nodeAssertionInstrumenter.js.map +0 -1
- package/dist/nodeTest.d.ts +0 -15
- package/dist/nodeTest.d.ts.map +0 -1
- package/dist/nodeTest.js.map +0 -1
- package/dist/playwright.d.ts +0 -9
- package/dist/playwright.d.ts.map +0 -1
- package/dist/playwright.js.map +0 -1
- package/dist/playwrightReporter.d.ts +0 -6
- package/dist/playwrightReporter.d.ts.map +0 -1
- package/dist/playwrightReporter.js.map +0 -1
- package/dist/project.d.ts +0 -20
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js +0 -296
- package/dist/project.js.map +0 -1
- package/dist/provenance.d.ts +0 -9
- package/dist/provenance.d.ts.map +0 -1
- package/dist/provenance.js.map +0 -1
- package/dist/query.d.ts +0 -70
- package/dist/query.d.ts.map +0 -1
- package/dist/query.js +0 -1443
- package/dist/query.js.map +0 -1
- package/dist/queryCache.d.ts +0 -15
- package/dist/queryCache.d.ts.map +0 -1
- package/dist/queryCache.js +0 -95
- package/dist/queryCache.js.map +0 -1
- package/dist/queueAdapters.d.ts +0 -15
- package/dist/queueAdapters.d.ts.map +0 -1
- package/dist/queueAdapters.js +0 -55
- package/dist/queueAdapters.js.map +0 -1
- package/dist/register.d.mts +0 -2
- package/dist/register.d.mts.map +0 -1
- package/dist/register.mjs.map +0 -1
- package/dist/reporter.d.ts +0 -13
- package/dist/reporter.d.ts.map +0 -1
- package/dist/reporter.js +0 -252
- package/dist/reporter.js.map +0 -1
- package/dist/resolve-loader.d.mts +0 -3
- package/dist/resolve-loader.d.mts.map +0 -1
- package/dist/resolve-loader.mjs.map +0 -1
- package/dist/runAnalysis.d.ts +0 -19
- package/dist/runAnalysis.d.ts.map +0 -1
- package/dist/runAnalysis.js +0 -169
- package/dist/runAnalysis.js.map +0 -1
- package/dist/runnerEvidence.d.ts +0 -19
- package/dist/runnerEvidence.d.ts.map +0 -1
- package/dist/runnerEvidence.js.map +0 -1
- package/dist/runtime.d.ts +0 -88
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js.map +0 -1
- package/dist/runtimeIsolation.d.ts +0 -3
- package/dist/runtimeIsolation.d.ts.map +0 -1
- package/dist/runtimeIsolation.js +0 -9
- package/dist/runtimeIsolation.js.map +0 -1
- package/dist/sourceDiscovery.d.ts +0 -9
- package/dist/sourceDiscovery.d.ts.map +0 -1
- package/dist/sourceDiscovery.js +0 -238
- package/dist/sourceDiscovery.js.map +0 -1
- package/dist/transport.d.ts +0 -17
- package/dist/transport.d.ts.map +0 -1
- package/dist/transport.js.map +0 -1
- package/dist/types.d.ts +0 -378
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/vitePlugin.d.ts +0 -13
- package/dist/vitePlugin.d.ts.map +0 -1
- package/dist/vitePlugin.js +0 -125
- package/dist/vitePlugin.js.map +0 -1
- package/dist/vitest.d.ts +0 -2
- package/dist/vitest.d.ts.map +0 -1
- package/dist/vitest.js.map +0 -1
- package/dist/vitestReporter.d.ts +0 -43
- package/dist/vitestReporter.d.ts.map +0 -1
- package/dist/vitestReporter.js.map +0 -1
- package/dist/workspace.d.ts +0 -81
- package/dist/workspace.d.ts.map +0 -1
- package/dist/workspace.js +0 -504
- package/dist/workspace.js.map +0 -1
|
@@ -102,10 +102,10 @@ function serverRunEvidenceDirectory(runId, root = configuredServerEvidenceRoot()
|
|
|
102
102
|
return `${root.replace(/\/+$/, "")}/${pathComponent(runId)}`;
|
|
103
103
|
}
|
|
104
104
|
function serverEvidenceDirectory(scope, root = configuredServerEvidenceRoot()) {
|
|
105
|
-
return `${serverRunEvidenceDirectory(scope.runId, root)}
|
|
105
|
+
return `${serverRunEvidenceDirectory(scope.runId, root)}/attempts`;
|
|
106
106
|
}
|
|
107
107
|
function serverEvidencePath(scope, root = configuredServerEvidenceRoot()) {
|
|
108
|
-
return `${serverEvidenceDirectory(scope, root)}
|
|
108
|
+
return `${serverEvidenceDirectory(scope, root)}/${pathComponent(scope.attemptId)}.jsonl`;
|
|
109
109
|
}
|
|
110
110
|
function backgroundEvidenceDirectory(runId, root = configuredServerEvidenceRoot()) {
|
|
111
111
|
return `${serverRunEvidenceDirectory(runId, root)}/background`;
|
|
@@ -148,9 +148,15 @@ function createState() {
|
|
|
148
148
|
bufferedAttempts: /* @__PURE__ */ new Set(),
|
|
149
149
|
serverBuffers: /* @__PURE__ */ new Map(),
|
|
150
150
|
persistedServerRecords: /* @__PURE__ */ new Set(),
|
|
151
|
+
backgroundBuffers: /* @__PURE__ */ new Map(),
|
|
151
152
|
backgroundSequence: 0,
|
|
152
153
|
runtimeSnapshots: false,
|
|
153
|
-
assertionPhases: /* @__PURE__ */ new Map()
|
|
154
|
+
assertionPhases: /* @__PURE__ */ new Map(),
|
|
155
|
+
probeV2Files: /* @__PURE__ */ new Set(),
|
|
156
|
+
probeV2Clock: { epoch: Number.NaN, fast: false },
|
|
157
|
+
probeV2ContextEpochs: /* @__PURE__ */ new Map(),
|
|
158
|
+
probeV2NextEpoch: 1,
|
|
159
|
+
probeV2HookInstalled: false
|
|
154
160
|
};
|
|
155
161
|
if (!isBrowser)
|
|
156
162
|
return state2;
|
|
@@ -197,6 +203,83 @@ var _a6;
|
|
|
197
203
|
var serverPhaseStorage = (_a6 = serverPhaseStorages.get(runtimeInstance)) != null ? _a6 : createServerPhaseStorage();
|
|
198
204
|
if (serverPhaseStorage)
|
|
199
205
|
serverPhaseStorages.set(runtimeInstance, serverPhaseStorage);
|
|
206
|
+
function probeV2ContextKey(context) {
|
|
207
|
+
var _a8, _b;
|
|
208
|
+
const phase = (_a8 = context.phaseId) != null ? _a8 : "unscoped";
|
|
209
|
+
if (!context.scope) {
|
|
210
|
+
const runId = typeof process !== "undefined" ? process.env["SUPERCOV_RUN_ID"] : void 0;
|
|
211
|
+
return `background\0${(_b = runId != null ? runId : runtimeGlobal.__SUPERCOV_MCDC_TEST_ID__) != null ? _b : testId}\0${phase}`;
|
|
212
|
+
}
|
|
213
|
+
return `scope\0${attemptKey(context.scope)}\0${phase}`;
|
|
214
|
+
}
|
|
215
|
+
function activateProbeV2Key(key, force = false) {
|
|
216
|
+
let epoch = force ? void 0 : state.probeV2ContextEpochs.get(key);
|
|
217
|
+
if (epoch === void 0) {
|
|
218
|
+
state.probeV2NextEpoch += 1;
|
|
219
|
+
if (state.probeV2NextEpoch >= 4294967295) {
|
|
220
|
+
state.probeV2NextEpoch = 1;
|
|
221
|
+
state.probeV2ContextEpochs.clear();
|
|
222
|
+
for (const file of state.probeV2Files) {
|
|
223
|
+
file.hitEpochs.fill(0);
|
|
224
|
+
file.decisionObservationEpochs.fill(0);
|
|
225
|
+
file.decisionObservationCounts.fill(0);
|
|
226
|
+
file.decisionCompleteEpochs.fill(0);
|
|
227
|
+
for (const vectors of file.decisionEpochs) {
|
|
228
|
+
if (vectors instanceof Uint32Array)
|
|
229
|
+
vectors.fill(0);
|
|
230
|
+
else
|
|
231
|
+
vectors.clear();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
epoch = state.probeV2NextEpoch;
|
|
236
|
+
state.probeV2ContextEpochs.set(key, epoch);
|
|
237
|
+
}
|
|
238
|
+
state.probeV2Clock.epoch = epoch;
|
|
239
|
+
return epoch;
|
|
240
|
+
}
|
|
241
|
+
function activateProbeV2Context(context) {
|
|
242
|
+
return activateProbeV2Key(probeV2ContextKey(context));
|
|
243
|
+
}
|
|
244
|
+
function withProbeV2Context(context, callback) {
|
|
245
|
+
const previous = state.probeV2Clock.epoch;
|
|
246
|
+
activateProbeV2Context(context);
|
|
247
|
+
try {
|
|
248
|
+
return callback();
|
|
249
|
+
} finally {
|
|
250
|
+
state.probeV2Clock.epoch = previous;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function installProbeV2AsyncHook() {
|
|
254
|
+
var _a8;
|
|
255
|
+
if (isBrowser || state.probeV2HookInstalled || typeof process === "undefined")
|
|
256
|
+
return;
|
|
257
|
+
try {
|
|
258
|
+
const getBuiltinModule = process.getBuiltinModule;
|
|
259
|
+
const createHook = (_a8 = getBuiltinModule == null ? void 0 : getBuiltinModule("node:async_hooks")) == null ? void 0 : _a8.createHook;
|
|
260
|
+
if (!createHook)
|
|
261
|
+
return;
|
|
262
|
+
const epochs = [];
|
|
263
|
+
createHook({
|
|
264
|
+
before() {
|
|
265
|
+
var _a9, _b;
|
|
266
|
+
epochs.push(state.probeV2Clock.epoch);
|
|
267
|
+
activateProbeV2Context((_b = (_a9 = serverPhaseStorage == null ? void 0 : serverPhaseStorage.getStore()) != null ? _a9 : environmentRequestContext()) != null ? _b : {});
|
|
268
|
+
},
|
|
269
|
+
after() {
|
|
270
|
+
var _a9;
|
|
271
|
+
state.probeV2Clock.epoch = (_a9 = epochs.pop()) != null ? _a9 : state.probeV2Clock.epoch;
|
|
272
|
+
}
|
|
273
|
+
}).enable();
|
|
274
|
+
state.probeV2HookInstalled = true;
|
|
275
|
+
state.probeV2Clock.fast = true;
|
|
276
|
+
} catch (e) {
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
runtimeGlobal.__SUPERCOV_ACTIVATE_PROBE_CONTEXT__ = (browserTestId, browserPhaseId) => {
|
|
280
|
+
state.probeV2Clock.fast = true;
|
|
281
|
+
activateProbeV2Key(`browser\0${browserTestId}\0${browserPhaseId != null ? browserPhaseId : "unscoped"}`);
|
|
282
|
+
};
|
|
200
283
|
function decisionSnapshot() {
|
|
201
284
|
return [...state.decisions.values()].map((decision) => ({
|
|
202
285
|
meta: decision.meta,
|
|
@@ -215,6 +298,8 @@ function resetCoverage(testId2) {
|
|
|
215
298
|
state.hits.clear();
|
|
216
299
|
state.events.length = 0;
|
|
217
300
|
state.eventKeys.clear();
|
|
301
|
+
state.probeV2ContextEpochs.clear();
|
|
302
|
+
activateProbeV2Key(`reset\0${state.probeV2NextEpoch}`, true);
|
|
218
303
|
if (testId2)
|
|
219
304
|
runtimeGlobal.__SUPERCOV_MCDC_TEST_ID__ = testId2;
|
|
220
305
|
if (isBrowser) {
|
|
@@ -246,24 +331,34 @@ function serverRecordKey(record) {
|
|
|
246
331
|
function beginBufferedServerEvidence(scope) {
|
|
247
332
|
if (isBrowser)
|
|
248
333
|
return;
|
|
249
|
-
|
|
334
|
+
const key = attemptKey(scope);
|
|
335
|
+
state.bufferedAttempts.add(key);
|
|
336
|
+
if (!state.serverBuffers.has(key))
|
|
337
|
+
state.serverBuffers.set(key, {
|
|
338
|
+
scope,
|
|
339
|
+
directory: serverEvidenceDirectory(scope),
|
|
340
|
+
path: serverEvidencePath(scope),
|
|
341
|
+
records: /* @__PURE__ */ new Map()
|
|
342
|
+
});
|
|
250
343
|
}
|
|
251
344
|
function flushBufferedServerEvidence(scope) {
|
|
252
345
|
if (isBrowser)
|
|
253
|
-
return;
|
|
346
|
+
return void 0;
|
|
254
347
|
const key = attemptKey(scope);
|
|
255
348
|
state.bufferedAttempts.delete(key);
|
|
256
349
|
const buffered = state.serverBuffers.get(key);
|
|
257
350
|
if (!buffered)
|
|
258
|
-
return;
|
|
351
|
+
return void 0;
|
|
259
352
|
state.serverBuffers.delete(key);
|
|
260
353
|
const fs = getFs();
|
|
261
354
|
if (!fs || buffered.records.size === 0)
|
|
262
|
-
return;
|
|
355
|
+
return void 0;
|
|
263
356
|
try {
|
|
264
357
|
fs.mkdirSync(buffered.directory, { recursive: true });
|
|
265
358
|
fs.appendFileSync(buffered.path, [...buffered.records.values()].map((record) => JSON.stringify(record)).join("\n") + "\n");
|
|
359
|
+
return buffered.path;
|
|
266
360
|
} catch (e) {
|
|
361
|
+
return void 0;
|
|
267
362
|
}
|
|
268
363
|
}
|
|
269
364
|
function enableRuntimeSnapshotEvidence() {
|
|
@@ -272,6 +367,32 @@ function enableRuntimeSnapshotEvidence() {
|
|
|
272
367
|
function flushAllBufferedServerEvidence() {
|
|
273
368
|
for (const buffered of [...state.serverBuffers.values()])
|
|
274
369
|
flushBufferedServerEvidence(buffered.scope);
|
|
370
|
+
for (const runId of [...state.backgroundBuffers.keys()])
|
|
371
|
+
flushBufferedBackgroundEvidence(runId);
|
|
372
|
+
}
|
|
373
|
+
function flushBufferedBackgroundEvidence(runId) {
|
|
374
|
+
var _a8;
|
|
375
|
+
if (isBrowser)
|
|
376
|
+
return void 0;
|
|
377
|
+
const records = state.backgroundBuffers.get(runId);
|
|
378
|
+
if (!records || records.size === 0)
|
|
379
|
+
return void 0;
|
|
380
|
+
const fs = getFs();
|
|
381
|
+
if (!fs)
|
|
382
|
+
return void 0;
|
|
383
|
+
const directory = backgroundEvidenceDirectory(runId);
|
|
384
|
+
const shard = (_a8 = process.env["SUPERCOV_EXECUTION_LOG_SHARD"]) != null ? _a8 : "process";
|
|
385
|
+
const writer = `${shard}-${process.pid}`;
|
|
386
|
+
const payload = [...records.values()].map((record) => JSON.stringify(record)).join("\n") + "\n";
|
|
387
|
+
try {
|
|
388
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
389
|
+
const nextSequence = writeExclusiveBackgroundRecord(fs, runId, writer, state.backgroundSequence, payload);
|
|
390
|
+
state.backgroundSequence = nextSequence;
|
|
391
|
+
state.backgroundBuffers.delete(runId);
|
|
392
|
+
return backgroundEvidencePath(runId, `${writer}-${nextSequence - 1}`);
|
|
393
|
+
} catch (e) {
|
|
394
|
+
return void 0;
|
|
395
|
+
}
|
|
275
396
|
}
|
|
276
397
|
function writeExclusiveBackgroundRecord(fs, runId, writer, initialSequence, payload) {
|
|
277
398
|
let sequence = initialSequence;
|
|
@@ -303,24 +424,44 @@ if (!isBrowser) {
|
|
|
303
424
|
}
|
|
304
425
|
}
|
|
305
426
|
function appendServer(record) {
|
|
306
|
-
var _a8, _b, _c;
|
|
307
|
-
if (state.runtimeSnapshots)
|
|
427
|
+
var _a8, _b, _c, _d;
|
|
428
|
+
if (state.runtimeSnapshots) {
|
|
429
|
+
const timestampMs = (_a8 = record.timestampMs) != null ? _a8 : Date.now();
|
|
430
|
+
if (record.type === "decision") {
|
|
431
|
+
recordBrowserEvent(__spreadProps(__spreadValues({
|
|
432
|
+
type: "decision",
|
|
433
|
+
id: record.meta.id,
|
|
434
|
+
vector: record.vector,
|
|
435
|
+
timestampMs
|
|
436
|
+
}, record.phaseId ? { phaseId: record.phaseId } : {}), {
|
|
437
|
+
environment: "server"
|
|
438
|
+
}));
|
|
439
|
+
} else {
|
|
440
|
+
recordBrowserEvent(__spreadProps(__spreadValues({
|
|
441
|
+
type: "hit",
|
|
442
|
+
id: record.id,
|
|
443
|
+
timestampMs
|
|
444
|
+
}, record.phaseId ? { phaseId: record.phaseId } : {}), {
|
|
445
|
+
environment: "server"
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
308
448
|
return;
|
|
449
|
+
}
|
|
309
450
|
const fs = getFs();
|
|
310
451
|
if (!fs)
|
|
311
452
|
return;
|
|
312
453
|
const context = currentRequestContext();
|
|
313
454
|
const scope = context.scope;
|
|
314
|
-
const runId = (
|
|
455
|
+
const runId = (_b = scope == null ? void 0 : scope.runId) != null ? _b : typeof process !== "undefined" ? process.env["SUPERCOV_RUN_ID"] : void 0;
|
|
315
456
|
if (!runId)
|
|
316
457
|
return;
|
|
317
458
|
try {
|
|
318
|
-
const directory = scope ? serverEvidenceDirectory(scope) :
|
|
459
|
+
const directory = scope ? serverEvidenceDirectory(scope) : void 0;
|
|
319
460
|
const path = scope ? serverEvidencePath(scope) : void 0;
|
|
320
461
|
const serialized = __spreadValues(__spreadValues({}, record), scope ? { scope } : {});
|
|
321
462
|
if (scope && state.bufferedAttempts.has(attemptKey(scope))) {
|
|
322
463
|
const key = attemptKey(scope);
|
|
323
|
-
const buffered = (
|
|
464
|
+
const buffered = (_c = state.serverBuffers.get(key)) != null ? _c : {
|
|
324
465
|
scope,
|
|
325
466
|
directory,
|
|
326
467
|
path,
|
|
@@ -333,14 +474,15 @@ function appendServer(record) {
|
|
|
333
474
|
const deduplicationKey = scope && serialized.phaseId ? `${attemptKey(scope)}:${serverRecordKey(serialized)}` : void 0;
|
|
334
475
|
if (deduplicationKey && state.persistedServerRecords.has(deduplicationKey))
|
|
335
476
|
return;
|
|
336
|
-
fs.mkdirSync(directory, { recursive: true });
|
|
337
477
|
if (!path) {
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
478
|
+
const buffered = (_d = state.backgroundBuffers.get(runId)) != null ? _d : /* @__PURE__ */ new Map();
|
|
479
|
+
buffered.set(serverRecordKey(serialized), serialized);
|
|
480
|
+
state.backgroundBuffers.set(runId, buffered);
|
|
481
|
+
if (buffered.size >= 4096)
|
|
482
|
+
flushBufferedBackgroundEvidence(runId);
|
|
342
483
|
return;
|
|
343
484
|
}
|
|
485
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
344
486
|
fs.appendFileSync(path, JSON.stringify(serialized) + "\n");
|
|
345
487
|
if (deduplicationKey)
|
|
346
488
|
state.persistedServerRecords.add(deduplicationKey);
|
|
@@ -354,8 +496,23 @@ function environmentRequestContext() {
|
|
|
354
496
|
return carrier ? __spreadValues(__spreadValues({}, carrier.scope ? { scope: carrier.scope } : {}), carrier.phaseId ? { phaseId: carrier.phaseId } : {}) : void 0;
|
|
355
497
|
}
|
|
356
498
|
function currentRequestContext() {
|
|
357
|
-
|
|
358
|
-
|
|
499
|
+
const stored = serverPhaseStorage == null ? void 0 : serverPhaseStorage.getStore();
|
|
500
|
+
if (stored !== void 0) {
|
|
501
|
+
if (stored.scope || stored.phaseId)
|
|
502
|
+
return stored;
|
|
503
|
+
return runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ ? { scope: runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ } : {};
|
|
504
|
+
}
|
|
505
|
+
const environment = environmentRequestContext();
|
|
506
|
+
if ((environment == null ? void 0 : environment.scope) || (environment == null ? void 0 : environment.phaseId))
|
|
507
|
+
return environment;
|
|
508
|
+
return runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ ? { scope: runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ } : {};
|
|
509
|
+
}
|
|
510
|
+
function activateCoverageScope(scope) {
|
|
511
|
+
if (scope)
|
|
512
|
+
runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__ = scope;
|
|
513
|
+
else
|
|
514
|
+
delete runtimeGlobal.__SUPERCOV_ACTIVE_SCOPE__;
|
|
515
|
+
activateProbeV2Context(scope ? { scope } : {});
|
|
359
516
|
}
|
|
360
517
|
function coverageCarrier() {
|
|
361
518
|
const context = currentRequestContext();
|
|
@@ -367,7 +524,8 @@ function withCoverageCarrier(carrier, callback) {
|
|
|
367
524
|
const decoded = typeof carrier === "string" ? decodeCoverageCarrier(carrier) : carrier;
|
|
368
525
|
if (!serverPhaseStorage || !decoded)
|
|
369
526
|
return callback();
|
|
370
|
-
|
|
527
|
+
const context = __spreadValues(__spreadValues({}, decoded.scope ? { scope: decoded.scope } : {}), decoded.phaseId ? { phaseId: decoded.phaseId } : {});
|
|
528
|
+
return serverPhaseStorage.run(context, () => withProbeV2Context(context, callback));
|
|
371
529
|
}
|
|
372
530
|
function assertionPhaseState(scope) {
|
|
373
531
|
const key = attemptKey(scope);
|
|
@@ -385,6 +543,7 @@ function finishAssertionPhase(phase, error) {
|
|
|
385
543
|
phase.error = error instanceof Error ? error.message : String(error);
|
|
386
544
|
}
|
|
387
545
|
function withNodeAssertionPhase(operation, source, callback) {
|
|
546
|
+
var _a8;
|
|
388
547
|
const context = currentRequestContext();
|
|
389
548
|
const scope = context.scope;
|
|
390
549
|
if (!scope)
|
|
@@ -392,9 +551,12 @@ function withNodeAssertionPhase(operation, source, callback) {
|
|
|
392
551
|
const existing = context.phaseId ? assertionPhaseState(scope).phases.find((phase2) => phase2.id === context.phaseId && phase2.kind === "assertion") : void 0;
|
|
393
552
|
if (existing)
|
|
394
553
|
return callback();
|
|
554
|
+
const bridged = (_a8 = runtimeGlobal.__SUPERCOV_ASSERTION_PHASE_BRIDGE__) == null ? void 0 : _a8.call(runtimeGlobal, operation, source, callback);
|
|
555
|
+
if (bridged == null ? void 0 : bridged.handled)
|
|
556
|
+
return bridged.value;
|
|
395
557
|
const attempt = assertionPhaseState(scope);
|
|
396
558
|
const phase = __spreadProps(__spreadValues({
|
|
397
|
-
id: `${scope.attemptId}:
|
|
559
|
+
id: `${scope.attemptId}:assertion:${++attempt.counter}`,
|
|
398
560
|
kind: "assertion",
|
|
399
561
|
operation
|
|
400
562
|
}, source ? { source } : {}), {
|
|
@@ -547,7 +709,7 @@ function requestCoverageContext(value) {
|
|
|
547
709
|
var _a8, _b;
|
|
548
710
|
const headers = requestHeaders(value);
|
|
549
711
|
if (!headers)
|
|
550
|
-
return
|
|
712
|
+
return void 0;
|
|
551
713
|
const rawCookie = headers.get("cookie");
|
|
552
714
|
const cookies = /* @__PURE__ */ new Map();
|
|
553
715
|
if (typeof rawCookie === "string") {
|
|
@@ -573,12 +735,12 @@ function withRequestPhase(handler) {
|
|
|
573
735
|
if (!serverPhaseStorage)
|
|
574
736
|
return handler;
|
|
575
737
|
return function coverageRequestPhase(...args) {
|
|
576
|
-
var _a8, _b, _c, _d
|
|
577
|
-
const requestContext =
|
|
578
|
-
const inheritedContext = currentRequestContext();
|
|
579
|
-
const context = __spreadValues(__spreadValues({}, ((
|
|
738
|
+
var _a8, _b, _c, _d;
|
|
739
|
+
const requestContext = args.map((argument) => requestCoverageContext(argument)).find((context2) => context2 !== void 0);
|
|
740
|
+
const inheritedContext = requestContext === void 0 ? currentRequestContext() : {};
|
|
741
|
+
const context = __spreadValues(__spreadValues({}, ((_a8 = requestContext == null ? void 0 : requestContext.scope) != null ? _a8 : inheritedContext.scope) ? { scope: (_b = requestContext == null ? void 0 : requestContext.scope) != null ? _b : inheritedContext.scope } : {}), ((_c = requestContext == null ? void 0 : requestContext.phaseId) != null ? _c : inheritedContext.phaseId) ? { phaseId: (_d = requestContext == null ? void 0 : requestContext.phaseId) != null ? _d : inheritedContext.phaseId } : {});
|
|
580
742
|
const invoke = () => Reflect.apply(handler, this, args);
|
|
581
|
-
return context.scope || context.phaseId ? serverPhaseStorage.run(context, invoke) : invoke();
|
|
743
|
+
return requestContext !== void 0 || context.scope || context.phaseId ? serverPhaseStorage.run(context, () => withProbeV2Context(context, invoke)) : invoke();
|
|
582
744
|
};
|
|
583
745
|
}
|
|
584
746
|
function eventKey(event) {
|
|
@@ -615,6 +777,109 @@ function coverageHit(id) {
|
|
|
615
777
|
}, phaseId ? { phaseId } : {}));
|
|
616
778
|
}
|
|
617
779
|
}
|
|
780
|
+
function registerProbeV2(definition) {
|
|
781
|
+
var _a8, _b;
|
|
782
|
+
const file = {
|
|
783
|
+
decisions: definition.decisions,
|
|
784
|
+
pointIds: definition.pointIds,
|
|
785
|
+
clock: state.probeV2Clock,
|
|
786
|
+
hitEpochs: new Uint32Array(definition.pointIds.length),
|
|
787
|
+
decisionEpochs: definition.decisions.map((meta) => meta.conditions.length <= 6 ? new Uint32Array(2 * 3 ** meta.conditions.length) : /* @__PURE__ */ new Map()),
|
|
788
|
+
decisionVectorCounts: definition.decisions.map((_, index) => {
|
|
789
|
+
var _a9, _b2;
|
|
790
|
+
return (_b2 = (_a9 = definition.decisionVectorCounts) == null ? void 0 : _a9[index]) != null ? _b2 : 0;
|
|
791
|
+
}),
|
|
792
|
+
decisionObservationEpochs: new Uint32Array(definition.decisions.length),
|
|
793
|
+
decisionObservationCounts: new Uint16Array(definition.decisions.length),
|
|
794
|
+
decisionCompleteEpochs: new Uint32Array(definition.decisions.length)
|
|
795
|
+
};
|
|
796
|
+
state.probeV2Files.add(file);
|
|
797
|
+
if (isBrowser) {
|
|
798
|
+
state.probeV2Clock.fast = true;
|
|
799
|
+
activateProbeV2Key(`browser\0${(_a8 = runtimeGlobal.__SUPERCOV_MCDC_TEST_ID__) != null ? _a8 : testId}\0${(_b = runtimeGlobal.__SUPERCOV_PHASE_ID__) != null ? _b : "unscoped"}`);
|
|
800
|
+
} else {
|
|
801
|
+
installProbeV2AsyncHook();
|
|
802
|
+
}
|
|
803
|
+
return file;
|
|
804
|
+
}
|
|
805
|
+
function coverageHitV2(file, index) {
|
|
806
|
+
const id = file.pointIds[index];
|
|
807
|
+
if (!id)
|
|
808
|
+
return;
|
|
809
|
+
const fallbackEpoch = !file.clock.fast;
|
|
810
|
+
const previousEpoch = file.clock.epoch;
|
|
811
|
+
if (fallbackEpoch)
|
|
812
|
+
activateProbeV2Context(currentRequestContext());
|
|
813
|
+
try {
|
|
814
|
+
const epoch = file.clock.epoch;
|
|
815
|
+
if (file.hitEpochs[index] === epoch)
|
|
816
|
+
return;
|
|
817
|
+
file.hitEpochs[index] = epoch;
|
|
818
|
+
coverageHit(id);
|
|
819
|
+
} finally {
|
|
820
|
+
if (fallbackEpoch)
|
|
821
|
+
file.clock.epoch = previousEpoch;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
function decodeProbeV2Vector(conditionCount, encoded, outcome) {
|
|
825
|
+
if (!Number.isSafeInteger(conditionCount) || conditionCount < 0 || conditionCount > 32 || !Number.isSafeInteger(encoded) || encoded < 0)
|
|
826
|
+
return void 0;
|
|
827
|
+
const values = [];
|
|
828
|
+
let remaining = encoded;
|
|
829
|
+
for (let index = 0; index < conditionCount; index += 1) {
|
|
830
|
+
const digit = remaining % 3;
|
|
831
|
+
values.push(digit === 0 ? null : digit === 2);
|
|
832
|
+
remaining = Math.floor(remaining / 3);
|
|
833
|
+
}
|
|
834
|
+
return remaining === 0 ? { values, outcome } : void 0;
|
|
835
|
+
}
|
|
836
|
+
function mcdcEndV2(file, decisionIndex, encoded, value) {
|
|
837
|
+
var _a8, _b;
|
|
838
|
+
const meta = file.decisions[decisionIndex];
|
|
839
|
+
if (!meta || !Number.isSafeInteger(encoded) || encoded < 0)
|
|
840
|
+
return value;
|
|
841
|
+
const outcome = Boolean(value);
|
|
842
|
+
const vectorIndex = encoded * 2 + (outcome ? 1 : 0);
|
|
843
|
+
if (!Number.isSafeInteger(vectorIndex))
|
|
844
|
+
return value;
|
|
845
|
+
const fallbackEpoch = !file.clock.fast;
|
|
846
|
+
const previousEpoch = file.clock.epoch;
|
|
847
|
+
if (fallbackEpoch)
|
|
848
|
+
activateProbeV2Context(currentRequestContext());
|
|
849
|
+
try {
|
|
850
|
+
const epoch = file.clock.epoch;
|
|
851
|
+
const seen = file.decisionEpochs[decisionIndex];
|
|
852
|
+
if (!seen)
|
|
853
|
+
return value;
|
|
854
|
+
if (seen instanceof Uint32Array) {
|
|
855
|
+
if (seen[vectorIndex] === epoch)
|
|
856
|
+
return value;
|
|
857
|
+
seen[vectorIndex] = epoch;
|
|
858
|
+
} else {
|
|
859
|
+
if (seen.get(vectorIndex) === epoch)
|
|
860
|
+
return value;
|
|
861
|
+
seen.set(vectorIndex, epoch);
|
|
862
|
+
}
|
|
863
|
+
const expectedCount = (_a8 = file.decisionVectorCounts[decisionIndex]) != null ? _a8 : 0;
|
|
864
|
+
if (expectedCount > 0) {
|
|
865
|
+
if (file.decisionObservationEpochs[decisionIndex] !== epoch) {
|
|
866
|
+
file.decisionObservationEpochs[decisionIndex] = epoch;
|
|
867
|
+
file.decisionObservationCounts[decisionIndex] = 0;
|
|
868
|
+
}
|
|
869
|
+
const observedCount = ((_b = file.decisionObservationCounts[decisionIndex]) != null ? _b : 0) + 1;
|
|
870
|
+
file.decisionObservationCounts[decisionIndex] = observedCount;
|
|
871
|
+
if (observedCount >= expectedCount)
|
|
872
|
+
file.decisionCompleteEpochs[decisionIndex] = epoch;
|
|
873
|
+
}
|
|
874
|
+
if (!state.decisions.has(meta.id))
|
|
875
|
+
state.decisions.set(meta.id, { meta, vectors: /* @__PURE__ */ new Map() });
|
|
876
|
+
const vector = decodeProbeV2Vector(meta.conditions.length, encoded, outcome);
|
|
877
|
+
return vector ? mcdcEnd({ meta, values: vector.values }, value) : value;
|
|
878
|
+
} finally {
|
|
879
|
+
if (fallbackEpoch)
|
|
880
|
+
file.clock.epoch = previousEpoch;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
618
883
|
function selectionBegin(shortId, rightId) {
|
|
619
884
|
return { shortId, rightId, rightEvaluated: false };
|
|
620
885
|
}
|
|
@@ -627,6 +892,15 @@ function applyInferredName(value, inferredName) {
|
|
|
627
892
|
}
|
|
628
893
|
return value;
|
|
629
894
|
}
|
|
895
|
+
var hostNamesParenthesizedAssignments = (() => {
|
|
896
|
+
let candidate;
|
|
897
|
+
candidate = function() {
|
|
898
|
+
};
|
|
899
|
+
return candidate.name === "candidate";
|
|
900
|
+
})();
|
|
901
|
+
function parenthesizedAssignmentValue(value, inferredName) {
|
|
902
|
+
return hostNamesParenthesizedAssignments ? applyInferredName(value, inferredName) : value;
|
|
903
|
+
}
|
|
630
904
|
function selectionRight(frame, value, inferredName) {
|
|
631
905
|
frame.rightEvaluated = true;
|
|
632
906
|
return applyInferredName(value, inferredName);
|
|
@@ -741,16 +1015,20 @@ function mcdcEnd(frame, value) {
|
|
|
741
1015
|
return value;
|
|
742
1016
|
}
|
|
743
1017
|
export {
|
|
1018
|
+
activateCoverageScope,
|
|
744
1019
|
beginBufferedServerEvidence,
|
|
745
1020
|
bindCoverageContext,
|
|
746
1021
|
coverageCarrier,
|
|
747
1022
|
coverageContextEnvironment,
|
|
748
1023
|
coverageContextHeaders,
|
|
749
1024
|
coverageHit,
|
|
1025
|
+
coverageHitV2,
|
|
750
1026
|
coverageSnapshot,
|
|
1027
|
+
decodeProbeV2Vector,
|
|
751
1028
|
defaultEntered,
|
|
752
1029
|
defaultSelected,
|
|
753
1030
|
enableRuntimeSnapshotEvidence,
|
|
1031
|
+
flushBufferedBackgroundEvidence,
|
|
754
1032
|
flushBufferedServerEvidence,
|
|
755
1033
|
loopBegin,
|
|
756
1034
|
loopEnd,
|
|
@@ -758,11 +1036,14 @@ export {
|
|
|
758
1036
|
mcdcBegin,
|
|
759
1037
|
mcdcCondition,
|
|
760
1038
|
mcdcEnd,
|
|
1039
|
+
mcdcEndV2,
|
|
761
1040
|
optionalCallBegin,
|
|
762
1041
|
optionalCallContinued,
|
|
763
1042
|
optionalCallEnd,
|
|
764
1043
|
optionalCallReached,
|
|
765
1044
|
optionalSelect,
|
|
1045
|
+
parenthesizedAssignmentValue,
|
|
1046
|
+
registerProbeV2,
|
|
766
1047
|
resetCoverage,
|
|
767
1048
|
selectionBegin,
|
|
768
1049
|
selectionEnd,
|
|
@@ -94,10 +94,10 @@ export function serverRunEvidenceDirectory(runId, root = configuredServerEvidenc
|
|
|
94
94
|
return `${root.replace(/\/+$/, "")}/${pathComponent(runId)}`;
|
|
95
95
|
}
|
|
96
96
|
export function serverEvidenceDirectory(scope, root = configuredServerEvidenceRoot()) {
|
|
97
|
-
return `${serverRunEvidenceDirectory(scope.runId, root)}
|
|
97
|
+
return `${serverRunEvidenceDirectory(scope.runId, root)}/attempts`;
|
|
98
98
|
}
|
|
99
99
|
export function serverEvidencePath(scope, root = configuredServerEvidenceRoot()) {
|
|
100
|
-
return `${serverEvidenceDirectory(scope, root)}
|
|
100
|
+
return `${serverEvidenceDirectory(scope, root)}/${pathComponent(scope.attemptId)}.jsonl`;
|
|
101
101
|
}
|
|
102
102
|
export function backgroundEvidenceDirectory(runId, root = configuredServerEvidenceRoot()) {
|
|
103
103
|
return `${serverRunEvidenceDirectory(runId, root)}/background`;
|
|
@@ -105,4 +105,3 @@ export function backgroundEvidenceDirectory(runId, root = configuredServerEviden
|
|
|
105
105
|
export function backgroundEvidencePath(runId, processId = typeof process === "undefined" ? "unknown" : String(process.pid), root = configuredServerEvidenceRoot()) {
|
|
106
106
|
return `${backgroundEvidenceDirectory(runId, root)}/${pathComponent(processId)}.jsonl`;
|
|
107
107
|
}
|
|
108
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { mkdirSync } from "node:fs";
|
|
2
3
|
import { relative, resolve, sep } from "node:path";
|
|
3
4
|
import { afterEach, beforeEach } from "vitest";
|
|
4
|
-
import { coverageSnapshot, enableRuntimeSnapshotEvidence, resetCoverage, } from "./runtime.js";
|
|
5
|
+
import { coverageSnapshot as localCoverageSnapshot, activateCoverageScope as localActivateCoverageScope, enableRuntimeSnapshotEvidence as localEnableRuntimeSnapshotEvidence, resetCoverage as localResetCoverage, takeNodeAssertionPhases as localTakeNodeAssertionPhases, } from "./runtime.js";
|
|
5
6
|
import { inferTestProvenance } from "./provenance.js";
|
|
6
7
|
import { atomicWriteFileSync } from "./atomic.js";
|
|
7
8
|
const evidenceDirectory = process.env["SUPERCOV_EVIDENCE_DIR"];
|
|
8
9
|
const emittedSetupFiles = new Set();
|
|
10
|
+
const attempts = new Map();
|
|
11
|
+
const activeScopes = new Map();
|
|
12
|
+
const runtimeGlobal = globalThis;
|
|
13
|
+
const runtime = runtimeGlobal.__SUPERCOV_DIRECT_RUNTIME__ ?? {
|
|
14
|
+
activateCoverageScope: localActivateCoverageScope,
|
|
15
|
+
coverageSnapshot: localCoverageSnapshot,
|
|
16
|
+
enableRuntimeSnapshotEvidence: localEnableRuntimeSnapshotEvidence,
|
|
17
|
+
resetCoverage: localResetCoverage,
|
|
18
|
+
takeNodeAssertionPhases: localTakeNodeAssertionPhases,
|
|
19
|
+
};
|
|
9
20
|
// Vitest persists one in-memory runtime snapshot per test. Writing the same
|
|
10
21
|
// events through the server JSONL transport would be both redundant and
|
|
11
22
|
// unattributed, and turns hot unit-test loops into synchronous filesystem IO.
|
|
12
|
-
enableRuntimeSnapshotEvidence();
|
|
23
|
+
runtime.enableRuntimeSnapshotEvidence();
|
|
13
24
|
function attemptStatus(state) {
|
|
14
25
|
if (state === "pass")
|
|
15
26
|
return "passed";
|
|
@@ -42,7 +53,7 @@ beforeEach((context) => {
|
|
|
42
53
|
.join("/");
|
|
43
54
|
if (!emittedSetupFiles.has(testFile)) {
|
|
44
55
|
emittedSetupFiles.add(testFile);
|
|
45
|
-
const setupSnapshot = coverageSnapshot();
|
|
56
|
+
const setupSnapshot = runtime.coverageSnapshot();
|
|
46
57
|
if (setupSnapshot.hits.length || setupSnapshot.decisions.length) {
|
|
47
58
|
writeEvidence({
|
|
48
59
|
testId: `vitest:${task.file.id}:setup`,
|
|
@@ -64,16 +75,33 @@ beforeEach((context) => {
|
|
|
64
75
|
}, `vitest-${task.file.id}-setup`);
|
|
65
76
|
}
|
|
66
77
|
}
|
|
67
|
-
|
|
78
|
+
const testId = `vitest:${task.id}`;
|
|
79
|
+
const retry = attempts.get(testId) ?? 0;
|
|
80
|
+
attempts.set(testId, retry + 1);
|
|
81
|
+
const testKey = createHash("sha256").update(testId).digest("hex").slice(0, 24);
|
|
82
|
+
const scope = {
|
|
83
|
+
version: 1,
|
|
84
|
+
runId: process.env["SUPERCOV_RUN_ID"] ?? "unscoped",
|
|
85
|
+
workerId: `vitest-${process.env["VITEST_POOL_ID"] ?? process.pid}`,
|
|
86
|
+
testId,
|
|
87
|
+
testKey,
|
|
88
|
+
retry,
|
|
89
|
+
attemptId: `${testKey}-${retry}`,
|
|
90
|
+
};
|
|
91
|
+
activeScopes.set(task.id, scope);
|
|
92
|
+
runtime.activateCoverageScope(scope);
|
|
93
|
+
runtime.resetCoverage(testId);
|
|
68
94
|
});
|
|
69
95
|
afterEach((context) => {
|
|
70
96
|
const task = context.task;
|
|
71
97
|
const testFile = relative(process.cwd(), task.file.filepath)
|
|
72
98
|
.split(sep)
|
|
73
99
|
.join("/");
|
|
74
|
-
const
|
|
100
|
+
const scope = activeScopes.get(task.id);
|
|
101
|
+
const retry = scope?.retry ?? task.result?.retryCount ?? 0;
|
|
75
102
|
const payload = {
|
|
76
|
-
testId: `vitest:${task.id}`,
|
|
103
|
+
testId: scope?.testId ?? `vitest:${task.id}`,
|
|
104
|
+
...(scope ? { scope } : {}),
|
|
77
105
|
test: [...titlePath(task)].join(" > "),
|
|
78
106
|
testFile,
|
|
79
107
|
title: task.name,
|
|
@@ -85,10 +113,12 @@ afterEach((context) => {
|
|
|
85
113
|
project: task.file.projectName,
|
|
86
114
|
explicitKind: process.env["SUPERCOV_TEST_KIND"],
|
|
87
115
|
}),
|
|
88
|
-
|
|
116
|
+
...(scope ? { phases: runtime.takeNodeAssertionPhases(scope) } : {}),
|
|
117
|
+
runtime: [runtime.coverageSnapshot()],
|
|
89
118
|
browser: [],
|
|
90
119
|
server: [],
|
|
91
120
|
};
|
|
92
121
|
writeEvidence(payload, `vitest-${task.id}-${retry}`);
|
|
122
|
+
activeScopes.delete(task.id);
|
|
123
|
+
runtime.activateCoverageScope();
|
|
93
124
|
});
|
|
94
|
-
//# sourceMappingURL=vitest.js.map
|
package/dist/agentJson.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export declare const AGENT_JSON_SCHEMA_VERSION: 1;
|
|
2
|
-
export declare const AGENT_JSON_MAX_BYTES: number;
|
|
3
|
-
export type SupercovErrorCode = "AMBIGUOUS_SELECTOR" | "DECISION_NOT_FOUND" | "FILTER_UNAVAILABLE" | "INTERNAL_ERROR" | "INVALID_ARGUMENT" | "MINIMIZATION_COMPLEXITY_LIMIT" | "NO_RUNS" | "RESPONSE_TOO_LARGE" | "RUN_NOT_FOUND" | "SCOPE_UNAVAILABLE" | "SOURCE_NOT_FOUND" | "TARGET_UNREACHABLE" | "TEST_FILTER_EMPTY" | "TEST_NOT_FOUND" | "UNATTRIBUTED_EVIDENCE" | "UNKNOWN_COMMAND";
|
|
4
|
-
export interface AgentJsonPagination {
|
|
5
|
-
offset: number;
|
|
6
|
-
limit: number;
|
|
7
|
-
returned: number;
|
|
8
|
-
total: number;
|
|
9
|
-
hasMore: boolean;
|
|
10
|
-
nextOffset: number | null;
|
|
11
|
-
}
|
|
12
|
-
export interface AgentJsonSuccess {
|
|
13
|
-
schemaVersion: typeof AGENT_JSON_SCHEMA_VERSION;
|
|
14
|
-
ok: true;
|
|
15
|
-
command: string;
|
|
16
|
-
data: unknown;
|
|
17
|
-
pagination?: AgentJsonPagination;
|
|
18
|
-
}
|
|
19
|
-
export interface AgentJsonFailure {
|
|
20
|
-
schemaVersion: typeof AGENT_JSON_SCHEMA_VERSION;
|
|
21
|
-
ok: false;
|
|
22
|
-
command?: string;
|
|
23
|
-
error: {
|
|
24
|
-
code: SupercovErrorCode;
|
|
25
|
-
message: string;
|
|
26
|
-
retryable: boolean;
|
|
27
|
-
details?: Record<string, unknown>;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export declare class SupercovError extends Error {
|
|
31
|
-
readonly code: SupercovErrorCode;
|
|
32
|
-
readonly retryable: boolean;
|
|
33
|
-
readonly details?: Record<string, unknown>;
|
|
34
|
-
constructor(code: SupercovErrorCode, message: string, options?: {
|
|
35
|
-
retryable?: boolean;
|
|
36
|
-
details?: Record<string, unknown>;
|
|
37
|
-
cause?: unknown;
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export declare function agentPagination(offset: number, limit: number, returned: number, total: number): AgentJsonPagination;
|
|
41
|
-
export declare function agentSuccessJson(command: string, data: unknown, pagination?: AgentJsonPagination): string;
|
|
42
|
-
export declare function asSupercovError(error: unknown): SupercovError;
|
|
43
|
-
export declare function agentFailureJson(error: unknown, command?: string): string;
|
|
44
|
-
//# sourceMappingURL=agentJson.d.ts.map
|
package/dist/agentJson.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentJson.d.ts","sourceRoot":"","sources":["../src/agentJson.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAC;AACpD,eAAO,MAAM,oBAAoB,QAAY,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GACzB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,GAChB,kBAAkB,GAClB,+BAA+B,GAC/B,SAAS,GACT,oBAAoB,GACpB,eAAe,GACf,mBAAmB,GACnB,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,uBAAuB,GACvB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,OAAO,yBAAyB,CAAC;IAChD,EAAE,EAAE,IAAI,CAAC;IACT,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,OAAO,yBAAyB,CAAC;IAChD,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE;QACL,IAAI,EAAE,iBAAiB,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,CAAC;CACH;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE3C,YACE,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,KAAK,CAAC,EAAE,OAAO,CAAC;KACZ,EAOP;CACF;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,mBAAmB,CAWrB;AAMD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,EACb,UAAU,CAAC,EAAE,mBAAmB,GAC/B,MAAM,CAwBR;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAO7D;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAyBR"}
|