vitest-gwt 4.0.1-beta.1 → 4.1.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/lib/index.cjs +1 -24
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -1
- package/lib/index.d.mts +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -4
- package/src/index.ts +5 -3
- package/src/withAspect.ts +2 -1
package/lib/index.cjs
CHANGED
|
@@ -2,31 +2,8 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
//#region \0rolldown/runtime.js
|
|
6
|
-
var __create = Object.create;
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
-
key = keys[i];
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: ((k) => from[k]).bind(null, key),
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
//#endregion
|
|
27
5
|
let vitest = require("vitest");
|
|
28
6
|
let gwt_runner = require("gwt-runner");
|
|
29
|
-
gwt_runner = __toESM(gwt_runner, 1);
|
|
30
7
|
//#region src/withAspect.ts
|
|
31
8
|
const withAspectBuilder = (beforeEach, afterEach) => (before, after) => {
|
|
32
9
|
beforeEach(async () => {
|
|
@@ -40,7 +17,7 @@ const withAspectBuilder = (beforeEach, afterEach) => (before, after) => {
|
|
|
40
17
|
};
|
|
41
18
|
//#endregion
|
|
42
19
|
//#region src/index.ts
|
|
43
|
-
const test = (0, gwt_runner.
|
|
20
|
+
const test = (0, gwt_runner.gwtRunner)(vitest.test);
|
|
44
21
|
const withAspect = withAspectBuilder(vitest.beforeEach, vitest.afterEach);
|
|
45
22
|
//#endregion
|
|
46
23
|
exports.TestContext = gwt_runner.TestContext;
|
package/lib/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["TestContext","vitestBeforeEach","vitestAfterEach"],"sources":["../src/withAspect.ts","../src/index.ts"],"sourcesContent":["import type { beforeEach as vitestBeforeEach, afterEach as vitestAfterEach } from \"vitest\";\nimport { TestContext } from \"gwt-runner\";\n\ntype Callback<T> = (this: T) => any;\n\nexport type WithAspectBuilder = (\n beforeEach: typeof vitestBeforeEach,\n afterEach: typeof vitestAfterEach,\n) => <T>(before: Callback<T>, after?: Callback<T>) => void;\n\nconst withAspectBuilder: WithAspectBuilder
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["TestContext","vitestBeforeEach","vitestAfterEach"],"sources":["../src/withAspect.ts","../src/index.ts"],"sourcesContent":["import type { beforeEach as vitestBeforeEach, afterEach as vitestAfterEach } from \"vitest\";\nimport { TestContext } from \"gwt-runner\";\n\ntype Callback<T> = (this: T) => any;\n\nexport type WithAspectBuilder = (\n beforeEach: typeof vitestBeforeEach,\n afterEach: typeof vitestAfterEach,\n) => <T>(before: Callback<T>, after?: Callback<T>) => void;\n\nconst withAspectBuilder: WithAspectBuilder =\n (beforeEach, afterEach) =>\n <T>(before: Callback<T>, after?: Callback<T>): void => {\n beforeEach(async () => {\n TestContext.createContext();\n\n await (before.bind(TestContext.context as T) as any)();\n });\n\n afterEach(async () => {\n if (after) {\n await (after.bind(TestContext.context as T) as any)();\n }\n\n TestContext.releaseContext();\n });\n };\n\nexport default withAspectBuilder;\n","import {\n test as vitest,\n beforeEach as vitestBeforeEach,\n afterEach as vitestAfterEach,\n} from \"vitest\";\nimport { gwtRunner, TestContext } from \"gwt-runner\";\nimport withAspectBuilder, { type WithAspectBuilder } from \"./withAspect\";\n\nconst test: ReturnType<typeof gwtRunner> = gwtRunner(vitest);\n\nexport default test;\nexport { TestContext };\n\nexport const withAspect: ReturnType<WithAspectBuilder> = withAspectBuilder(\n vitestBeforeEach,\n vitestAfterEach,\n);\n"],"mappings":";;;;;;;AAUA,MAAM,qBACH,YAAY,eACT,QAAqB,UAA8B;CACrD,WAAW,YAAY;EACrB,WAAA,YAAY,cAAc;EAE1B,MAAO,OAAO,KAAKA,WAAAA,YAAY,OAAY,CAAC,CAAS;CACvD,CAAC;CAED,UAAU,YAAY;EACpB,IAAI,OACF,MAAO,MAAM,KAAKA,WAAAA,YAAY,OAAY,CAAC,CAAS;EAGtD,WAAA,YAAY,eAAe;CAC7B,CAAC;AACH;;;AClBF,MAAM,QAAA,GAAA,WAAA,UAAA,CAA+C,OAAA,IAAM;AAK3D,MAAa,aAA4C,kBACvDC,OAAAA,YACAC,OAAAA,SACF"}
|
package/lib/index.d.cts
CHANGED
package/lib/index.d.mts
CHANGED
package/lib/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, test as test$1 } from "vitest";
|
|
2
|
-
import
|
|
2
|
+
import { TestContext, TestContext as TestContext$1, gwtRunner } from "gwt-runner";
|
|
3
3
|
//#region src/withAspect.ts
|
|
4
4
|
const withAspectBuilder = (beforeEach, afterEach) => (before, after) => {
|
|
5
5
|
beforeEach(async () => {
|
package/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["TestContext","vitest","vitestBeforeEach","vitestAfterEach"],"sources":["../src/withAspect.ts","../src/index.ts"],"sourcesContent":["import type { beforeEach as vitestBeforeEach, afterEach as vitestAfterEach } from \"vitest\";\nimport { TestContext } from \"gwt-runner\";\n\ntype Callback<T> = (this: T) => any;\n\nexport type WithAspectBuilder = (\n beforeEach: typeof vitestBeforeEach,\n afterEach: typeof vitestAfterEach,\n) => <T>(before: Callback<T>, after?: Callback<T>) => void;\n\nconst withAspectBuilder: WithAspectBuilder
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["TestContext","vitest","vitestBeforeEach","vitestAfterEach"],"sources":["../src/withAspect.ts","../src/index.ts"],"sourcesContent":["import type { beforeEach as vitestBeforeEach, afterEach as vitestAfterEach } from \"vitest\";\nimport { TestContext } from \"gwt-runner\";\n\ntype Callback<T> = (this: T) => any;\n\nexport type WithAspectBuilder = (\n beforeEach: typeof vitestBeforeEach,\n afterEach: typeof vitestAfterEach,\n) => <T>(before: Callback<T>, after?: Callback<T>) => void;\n\nconst withAspectBuilder: WithAspectBuilder =\n (beforeEach, afterEach) =>\n <T>(before: Callback<T>, after?: Callback<T>): void => {\n beforeEach(async () => {\n TestContext.createContext();\n\n await (before.bind(TestContext.context as T) as any)();\n });\n\n afterEach(async () => {\n if (after) {\n await (after.bind(TestContext.context as T) as any)();\n }\n\n TestContext.releaseContext();\n });\n };\n\nexport default withAspectBuilder;\n","import {\n test as vitest,\n beforeEach as vitestBeforeEach,\n afterEach as vitestAfterEach,\n} from \"vitest\";\nimport { gwtRunner, TestContext } from \"gwt-runner\";\nimport withAspectBuilder, { type WithAspectBuilder } from \"./withAspect\";\n\nconst test: ReturnType<typeof gwtRunner> = gwtRunner(vitest);\n\nexport default test;\nexport { TestContext };\n\nexport const withAspect: ReturnType<WithAspectBuilder> = withAspectBuilder(\n vitestBeforeEach,\n vitestAfterEach,\n);\n"],"mappings":";;;AAUA,MAAM,qBACH,YAAY,eACT,QAAqB,UAA8B;CACrD,WAAW,YAAY;EACrB,cAAY,cAAc;EAE1B,MAAO,OAAO,KAAKA,cAAY,OAAY,CAAC,CAAS;CACvD,CAAC;CAED,UAAU,YAAY;EACpB,IAAI,OACF,MAAO,MAAM,KAAKA,cAAY,OAAY,CAAC,CAAS;EAGtD,cAAY,eAAe;CAC7B,CAAC;AACH;;;AClBF,MAAM,OAAqC,UAAUC,MAAM;AAK3D,MAAa,aAA4C,kBACvDC,YACAC,SACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-gwt",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A small library to help Vitest support given-when-then style testing without a bunch of overhead",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"given",
|
|
@@ -51,14 +51,12 @@
|
|
|
51
51
|
"prepublishOnly": "wireit"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"gwt-runner": "^
|
|
54
|
+
"gwt-runner": "^3.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/lodash": "^4.17.24",
|
|
58
57
|
"@types/node": "^25.9.3",
|
|
59
58
|
"@vitest/coverage-v8": "^4.1.9",
|
|
60
59
|
"axios": "^1.18.0",
|
|
61
|
-
"lodash": "^4.18.1",
|
|
62
60
|
"typescript": "^6.0.3",
|
|
63
61
|
"vitest": "^4.1.9",
|
|
64
62
|
"wireit": "^0.14.12"
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
beforeEach as vitestBeforeEach,
|
|
4
4
|
afterEach as vitestAfterEach,
|
|
5
5
|
} from "vitest";
|
|
6
|
-
import gwtRunner,
|
|
6
|
+
import { gwtRunner, TestContext } from "gwt-runner";
|
|
7
7
|
import withAspectBuilder, { type WithAspectBuilder } from "./withAspect";
|
|
8
8
|
|
|
9
9
|
const test: ReturnType<typeof gwtRunner> = gwtRunner(vitest);
|
|
@@ -11,5 +11,7 @@ const test: ReturnType<typeof gwtRunner> = gwtRunner(vitest);
|
|
|
11
11
|
export default test;
|
|
12
12
|
export { TestContext };
|
|
13
13
|
|
|
14
|
-
export const withAspect: ReturnType<WithAspectBuilder> =
|
|
15
|
-
|
|
14
|
+
export const withAspect: ReturnType<WithAspectBuilder> = withAspectBuilder(
|
|
15
|
+
vitestBeforeEach,
|
|
16
|
+
vitestAfterEach,
|
|
17
|
+
);
|
package/src/withAspect.ts
CHANGED
|
@@ -8,7 +8,8 @@ export type WithAspectBuilder = (
|
|
|
8
8
|
afterEach: typeof vitestAfterEach,
|
|
9
9
|
) => <T>(before: Callback<T>, after?: Callback<T>) => void;
|
|
10
10
|
|
|
11
|
-
const withAspectBuilder: WithAspectBuilder =
|
|
11
|
+
const withAspectBuilder: WithAspectBuilder =
|
|
12
|
+
(beforeEach, afterEach) =>
|
|
12
13
|
<T>(before: Callback<T>, after?: Callback<T>): void => {
|
|
13
14
|
beforeEach(async () => {
|
|
14
15
|
TestContext.createContext();
|