@skuba-lib/vitest-koa-mocks 1.0.1 → 1.0.2-replace-global-vars-20260417065206
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/lib/index.cjs +8 -16
- package/lib/index.d.cts +2 -2
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +1 -4
- package/package.json +7 -3
package/lib/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
20
16
|
}
|
|
21
17
|
return to;
|
|
22
18
|
};
|
|
@@ -24,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
20
|
value: mod,
|
|
25
21
|
enumerable: true
|
|
26
22
|
}) : target, mod));
|
|
27
|
-
|
|
28
23
|
//#endregion
|
|
29
24
|
let stream = require("stream");
|
|
30
25
|
stream = __toESM(stream);
|
|
@@ -33,7 +28,6 @@ koa = __toESM(koa);
|
|
|
33
28
|
let node_mocks_http = require("node-mocks-http");
|
|
34
29
|
node_mocks_http = __toESM(node_mocks_http);
|
|
35
30
|
let vitest = require("vitest");
|
|
36
|
-
|
|
37
31
|
//#region src/createMockCookies/createMockCookies.ts
|
|
38
32
|
const createMockCookies = (cookies = {}, secure = true) => {
|
|
39
33
|
const cookieEntries = Object.keys(cookies).map((key) => [key, cookies[key]]);
|
|
@@ -47,7 +41,6 @@ const createMockCookies = (cookies = {}, secure = true) => {
|
|
|
47
41
|
secure
|
|
48
42
|
};
|
|
49
43
|
};
|
|
50
|
-
|
|
51
44
|
//#endregion
|
|
52
45
|
//#region src/createMockContext/createMockContext.ts
|
|
53
46
|
const createMockContext = (options = {}) => {
|
|
@@ -88,7 +81,6 @@ const createMockContext = (options = {}) => {
|
|
|
88
81
|
context.request.rawBody = rawBody;
|
|
89
82
|
return context;
|
|
90
83
|
};
|
|
91
|
-
|
|
92
84
|
//#endregion
|
|
93
85
|
exports.createMockContext = createMockContext;
|
|
94
|
-
exports.createMockCookies = createMockCookies;
|
|
86
|
+
exports.createMockCookies = createMockCookies;
|
package/lib/index.d.cts
CHANGED
|
@@ -23,10 +23,10 @@ interface Options<CustomProperties extends object, RequestBody = undefined> {
|
|
|
23
23
|
url?: string;
|
|
24
24
|
method?: RequestMethod;
|
|
25
25
|
statusCode?: number;
|
|
26
|
-
session?: Record<string,
|
|
26
|
+
session?: Record<string, any>;
|
|
27
27
|
headers?: Record<string, string>;
|
|
28
28
|
cookies?: Record<string, string>;
|
|
29
|
-
state?: Record<string,
|
|
29
|
+
state?: Record<string, any>;
|
|
30
30
|
encrypted?: boolean;
|
|
31
31
|
host?: string;
|
|
32
32
|
requestBody?: RequestBody;
|
package/lib/index.d.mts
CHANGED
|
@@ -23,10 +23,10 @@ interface Options<CustomProperties extends object, RequestBody = undefined> {
|
|
|
23
23
|
url?: string;
|
|
24
24
|
method?: RequestMethod;
|
|
25
25
|
statusCode?: number;
|
|
26
|
-
session?: Record<string,
|
|
26
|
+
session?: Record<string, any>;
|
|
27
27
|
headers?: Record<string, string>;
|
|
28
28
|
cookies?: Record<string, string>;
|
|
29
|
-
state?: Record<string,
|
|
29
|
+
state?: Record<string, any>;
|
|
30
30
|
encrypted?: boolean;
|
|
31
31
|
host?: string;
|
|
32
32
|
requestBody?: RequestBody;
|
package/lib/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import stream from "stream";
|
|
|
2
2
|
import Koa from "koa";
|
|
3
3
|
import httpMocks from "node-mocks-http";
|
|
4
4
|
import { vi } from "vitest";
|
|
5
|
-
|
|
6
5
|
//#region src/createMockCookies/createMockCookies.ts
|
|
7
6
|
const createMockCookies = (cookies = {}, secure = true) => {
|
|
8
7
|
const cookieEntries = Object.keys(cookies).map((key) => [key, cookies[key]]);
|
|
@@ -16,7 +15,6 @@ const createMockCookies = (cookies = {}, secure = true) => {
|
|
|
16
15
|
secure
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
|
-
|
|
20
18
|
//#endregion
|
|
21
19
|
//#region src/createMockContext/createMockContext.ts
|
|
22
20
|
const createMockContext = (options = {}) => {
|
|
@@ -57,6 +55,5 @@ const createMockContext = (options = {}) => {
|
|
|
57
55
|
context.request.rawBody = rawBody;
|
|
58
56
|
return context;
|
|
59
57
|
};
|
|
60
|
-
|
|
61
58
|
//#endregion
|
|
62
|
-
export { createMockContext, createMockCookies };
|
|
59
|
+
export { createMockContext, createMockCookies };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skuba-lib/vitest-koa-mocks",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-replace-global-vars-20260417065206",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Vitest mocks for Koa",
|
|
6
6
|
"homepage": "https://github.com/seek-oss/skuba/tree/main/packages/vitest-koa-mocks#readme",
|
|
@@ -28,12 +28,16 @@
|
|
|
28
28
|
"lib"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@types/node": "^20.0.0 || ^22.0.0 || ^24.0.0",
|
|
31
32
|
"node-mocks-http": "^1.17.2"
|
|
32
33
|
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^24.1.0"
|
|
36
|
+
},
|
|
33
37
|
"peerDependencies": {
|
|
34
38
|
"@types/koa": "^3.0.1",
|
|
35
39
|
"koa": "^3.1.1",
|
|
36
|
-
"vitest": "^4.
|
|
40
|
+
"vitest": "^4.1.4"
|
|
37
41
|
},
|
|
38
42
|
"engines": {
|
|
39
43
|
"node": ">=22.14.0"
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
"entryPoint": "src/index.ts",
|
|
43
47
|
"template": "oss-npm-package",
|
|
44
48
|
"type": "package",
|
|
45
|
-
"version": "15.
|
|
49
|
+
"version": "15.3.0"
|
|
46
50
|
},
|
|
47
51
|
"scripts": {
|
|
48
52
|
"build": "pnpm skuba build-package",
|