@eggjs/mock 7.0.2-beta.4 → 7.0.2-beta.5

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.
@@ -51,6 +51,7 @@ function formatOptions(initOptions) {
51
51
  const env = process.env.EGG_SERVER_ENV;
52
52
  if (!isMocked(process.env, "HOME") && (env === "default" || env === "test" || env === "prod")) mm(process.env, "HOME", options.baseDir);
53
53
  if (process.env.EGG_MOCK_SERVER_ENV) options.cache = false;
54
+ if (!options.startMode && process.env.EGG_VITEST_POOL === "threads") options.startMode = "worker_threads";
54
55
  debug("[formatOptions] options: %j", options);
55
56
  return options;
56
57
  }
@@ -46,6 +46,10 @@ interface MockOptions {
46
46
  */
47
47
  mockCtxStorage?: boolean;
48
48
  beforeInit?: (app: any) => Promise<void>;
49
+ /**
50
+ * Start mode for egg cluster-client
51
+ */
52
+ startMode?: "process" | "worker_threads";
49
53
  }
50
54
  interface MockClusterOptions extends MockOptions {
51
55
  workers?: number | string;
@@ -32,6 +32,7 @@ afterEach(async () => {
32
32
  await proxyMock.restore();
33
33
  });
34
34
  afterAll(async () => {
35
+ if (globalThis.__eggVitestSharedMode || process.env.EGG_VITEST_ISOLATE === "false" || process.env.EGG_VITEST_POOL === "threads") return;
35
36
  if (app) await app.close();
36
37
  });
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/mock",
3
- "version": "7.0.2-beta.4",
3
+ "version": "7.0.2-beta.5",
4
4
  "description": "mock server plugin for egg",
5
5
  "keywords": [
6
6
  "egg",
@@ -72,20 +72,20 @@
72
72
  "sdk-base": "^5.0.1",
73
73
  "urllib": "^4.8.2",
74
74
  "utility": "^2.5.0",
75
- "@eggjs/utils": "5.0.2-beta.4",
76
- "@eggjs/extend2": "5.0.2-beta.4",
77
- "@eggjs/supertest": "9.0.2-beta.4"
75
+ "@eggjs/extend2": "5.0.2-beta.5",
76
+ "@eggjs/supertest": "9.0.2-beta.5",
77
+ "@eggjs/utils": "5.0.2-beta.5"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/methods": "^1.1.4",
81
81
  "typescript": "^5.9.3",
82
- "@eggjs/errors": "3.0.2-beta.4",
83
- "egg": "4.1.2-beta.4",
84
- "@eggjs/tracer": "4.0.2-beta.4"
82
+ "@eggjs/tracer": "4.0.2-beta.5",
83
+ "egg": "4.1.2-beta.5",
84
+ "@eggjs/errors": "3.0.2-beta.5"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "vitest": "^4.0.15",
88
- "egg": "4.1.2-beta.4"
88
+ "egg": "4.1.2-beta.5"
89
89
  },
90
90
  "peerDependenciesMeta": {
91
91
  "vitest": {