@eggjs/mock 7.0.0-beta.36 → 7.0.1-beta.0
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/setup_vitest.d.ts +1 -0
- package/dist/setup_vitest.js +25 -0
- package/package.json +15 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { mm as proxyMock } from "./index.js";
|
|
2
|
+
import { afterAll, afterEach, beforeAll, beforeEach } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/setup_vitest.ts
|
|
5
|
+
const g = globalThis;
|
|
6
|
+
if (!g.before) g.before = beforeAll;
|
|
7
|
+
if (!g.after) g.after = afterAll;
|
|
8
|
+
if (!g.beforeEach) g.beforeEach = beforeEach;
|
|
9
|
+
if (!g.afterEach) g.afterEach = afterEach;
|
|
10
|
+
let app;
|
|
11
|
+
beforeAll(async () => {
|
|
12
|
+
const { app: bootstrapApp } = await import("./bootstrap.js");
|
|
13
|
+
app = bootstrapApp;
|
|
14
|
+
await app.ready();
|
|
15
|
+
});
|
|
16
|
+
afterEach(async () => {
|
|
17
|
+
if (app && typeof app.backgroundTasksFinished === "function") await app.backgroundTasksFinished();
|
|
18
|
+
await proxyMock.restore();
|
|
19
|
+
});
|
|
20
|
+
afterAll(async () => {
|
|
21
|
+
if (app) await app.close();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/mock",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1-beta.0",
|
|
4
4
|
"description": "mock server plugin for egg",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"egg",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"./lib/types": "./dist/lib/types.js",
|
|
56
56
|
"./lib/utils": "./dist/lib/utils.js",
|
|
57
57
|
"./register": "./dist/register.js",
|
|
58
|
+
"./setup_vitest": "./dist/setup_vitest.js",
|
|
58
59
|
"./package.json": "./package.json"
|
|
59
60
|
},
|
|
60
61
|
"publishConfig": {
|
|
@@ -71,19 +72,25 @@
|
|
|
71
72
|
"sdk-base": "^5.0.1",
|
|
72
73
|
"urllib": "^4.8.2",
|
|
73
74
|
"utility": "^2.5.0",
|
|
74
|
-
"@eggjs/extend2": "5.0.
|
|
75
|
-
"@eggjs/supertest": "9.0.
|
|
76
|
-
"@eggjs/utils": "5.0.
|
|
75
|
+
"@eggjs/extend2": "5.0.1-beta.0",
|
|
76
|
+
"@eggjs/supertest": "9.0.1-beta.0",
|
|
77
|
+
"@eggjs/utils": "5.0.1-beta.0"
|
|
77
78
|
},
|
|
78
79
|
"devDependencies": {
|
|
79
80
|
"@types/methods": "^1.1.4",
|
|
80
81
|
"typescript": "^5.9.3",
|
|
81
|
-
"@eggjs/errors": "3.0.
|
|
82
|
-
"
|
|
83
|
-
"
|
|
82
|
+
"@eggjs/errors": "3.0.1-beta.0",
|
|
83
|
+
"egg": "4.1.1-beta.0",
|
|
84
|
+
"@eggjs/tracer": "4.0.1-beta.0"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
|
-
"
|
|
87
|
+
"vitest": "^4.0.15",
|
|
88
|
+
"egg": "4.1.1-beta.0"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"vitest": {
|
|
92
|
+
"optional": true
|
|
93
|
+
}
|
|
87
94
|
},
|
|
88
95
|
"engines": {
|
|
89
96
|
"node": ">=22.18.0"
|