@cloudflare/vitest-pool-workers 0.12.10 → 0.12.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/dist/pool/index.mjs +23 -14
- package/dist/pool/index.mjs.map +1 -1
- package/dist/worker/lib/cloudflare/mock-agent.cjs +129 -129
- package/dist/worker/lib/cloudflare/mock-agent.cjs.map +1 -1
- package/dist/worker/lib/cloudflare/test-internal.mjs +10 -10
- package/dist/worker/lib/cloudflare/test-internal.mjs.map +1 -1
- package/package.json +6 -5
package/dist/pool/index.mjs
CHANGED
|
@@ -634,7 +634,7 @@ var require_cmp = __commonJS({
|
|
|
634
634
|
var require_comparator = __commonJS({
|
|
635
635
|
"../../node_modules/.pnpm/semver@7.7.1/node_modules/semver/classes/comparator.js"(exports, module) {
|
|
636
636
|
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
637
|
-
var ANY = Symbol("SemVer ANY");
|
|
637
|
+
var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
|
|
638
638
|
var Comparator = class _Comparator {
|
|
639
639
|
static get ANY() {
|
|
640
640
|
return ANY;
|
|
@@ -5909,7 +5909,7 @@ ZodNaN.create = (params) => {
|
|
|
5909
5909
|
...processCreateParams(params)
|
|
5910
5910
|
});
|
|
5911
5911
|
};
|
|
5912
|
-
var BRAND = Symbol("zod_brand");
|
|
5912
|
+
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
|
|
5913
5913
|
var ZodBranded = class extends ZodType {
|
|
5914
5914
|
_parse(input) {
|
|
5915
5915
|
const { ctx } = this._processInputParams(input);
|
|
@@ -6463,6 +6463,7 @@ async function guessWorkerExports(entryFile, additionalExports = {}) {
|
|
|
6463
6463
|
// src/pool/loopback.ts
|
|
6464
6464
|
init_define_VITEST_POOL_WORKERS_DEFINE_BUILTIN_MODULES();
|
|
6465
6465
|
import assert2 from "node:assert";
|
|
6466
|
+
import { opendirSync, rmSync } from "node:fs";
|
|
6466
6467
|
import fs from "node:fs/promises";
|
|
6467
6468
|
import path4 from "node:path";
|
|
6468
6469
|
import {
|
|
@@ -6512,26 +6513,34 @@ async function handleSnapshotRequest(request, url) {
|
|
|
6512
6513
|
}
|
|
6513
6514
|
return new Response(null, { status: 405 });
|
|
6514
6515
|
}
|
|
6515
|
-
|
|
6516
|
-
let
|
|
6516
|
+
function emptyDir(dirPath) {
|
|
6517
|
+
let dir;
|
|
6517
6518
|
try {
|
|
6518
|
-
|
|
6519
|
+
dir = opendirSync(dirPath);
|
|
6519
6520
|
} catch (e) {
|
|
6520
6521
|
if (isFileNotFoundError(e)) {
|
|
6521
6522
|
return;
|
|
6522
6523
|
}
|
|
6523
6524
|
throw e;
|
|
6524
6525
|
}
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
if (
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6526
|
+
try {
|
|
6527
|
+
let entry;
|
|
6528
|
+
while ((entry = dir.readSync()) !== null) {
|
|
6529
|
+
const fullPath = path4.join(dirPath, entry.name);
|
|
6530
|
+
if (entry.isDirectory()) {
|
|
6531
|
+
emptyDir(fullPath);
|
|
6532
|
+
} else {
|
|
6533
|
+
try {
|
|
6534
|
+
rmSync(fullPath, { force: true });
|
|
6535
|
+
} catch (e) {
|
|
6536
|
+
if (isEbusyError(e)) {
|
|
6537
|
+
console.warn(`vitest-pool-worker: Unable to remove file: ${e}`);
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6533
6540
|
}
|
|
6534
6541
|
}
|
|
6542
|
+
} finally {
|
|
6543
|
+
dir.closeSync();
|
|
6535
6544
|
}
|
|
6536
6545
|
}
|
|
6537
6546
|
function isEbusyError(e) {
|
|
@@ -6586,7 +6595,7 @@ function scheduleStorageReset(mf) {
|
|
|
6586
6595
|
const abortAllWorker = await mf.getWorker(ABORT_ALL_WORKER_NAME);
|
|
6587
6596
|
await abortAllWorker.fetch("http://placeholder", { method: "DELETE" });
|
|
6588
6597
|
for (const persistPath of state.persistPaths) {
|
|
6589
|
-
|
|
6598
|
+
emptyDir(persistPath);
|
|
6590
6599
|
}
|
|
6591
6600
|
state.depth = 0;
|
|
6592
6601
|
state.storageResetPromise = void 0;
|