vitest-gwt 0.0.1 → 0.0.3-alpha.1
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.js +6 -10
- package/lib/index.js.map +1 -1
- package/lib/withAspect.js +13 -33
- package/lib/withAspect.js.map +1 -1
- package/package.json +6 -2
- package/src/index.ts +1 -1
- package/src/withAspect.ts +2 -2
package/lib/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "TestContext", { enumerable: true, get: function () { return gwt_runner_1.TestContext; } });
|
|
8
|
-
var withAspect_1 = tslib_1.__importDefault(require("./withAspect"));
|
|
9
|
-
exports.default = (0, gwt_runner_1.default)(vitest_1.test);
|
|
10
|
-
exports.withAspect = (0, withAspect_1.default)(vitest_1.beforeEach, vitest_1.afterEach);
|
|
1
|
+
import { test as vitest, beforeEach as vitestBeforeEach, afterEach as vitestAfterEach, } from 'vitest';
|
|
2
|
+
import gwtRunner, { TestContext } from 'gwt-runner';
|
|
3
|
+
import withAspectBuilder from './withAspect.js';
|
|
4
|
+
export default gwtRunner(vitest);
|
|
5
|
+
export { TestContext };
|
|
6
|
+
export const withAspect = withAspectBuilder(vitestBeforeEach, vitestAfterEach);
|
|
11
7
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,IAAI,MAAM,EACd,UAAU,IAAI,gBAAgB,EAC9B,SAAS,IAAI,eAAe,GAC7B,MAAM,QAAQ,CAAC;AAChB,OAAO,SAAS,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAEhD,eAAe,SAAS,CAAC,MAAM,CAAC,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,eAAe,CAAC,CAAC"}
|
package/lib/withAspect.js
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return [2 /*return*/];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}); });
|
|
18
|
-
afterEach(function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
19
|
-
return tslib_1.__generator(this, function (_a) {
|
|
20
|
-
switch (_a.label) {
|
|
21
|
-
case 0:
|
|
22
|
-
if (!after) return [3 /*break*/, 2];
|
|
23
|
-
return [4 /*yield*/, after.bind(gwt_runner_1.TestContext.context)()];
|
|
24
|
-
case 1:
|
|
25
|
-
_a.sent();
|
|
26
|
-
_a.label = 2;
|
|
27
|
-
case 2:
|
|
28
|
-
gwt_runner_1.TestContext.releaseContext();
|
|
29
|
-
return [2 /*return*/];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}); });
|
|
33
|
-
}); });
|
|
1
|
+
import { TestContext } from 'gwt-runner';
|
|
2
|
+
export default (beforeEach, afterEach) => ((before, after) => {
|
|
3
|
+
beforeEach(async () => {
|
|
4
|
+
TestContext.createContext();
|
|
5
|
+
await before.bind(TestContext.context)();
|
|
6
|
+
});
|
|
7
|
+
afterEach(async () => {
|
|
8
|
+
if (after) {
|
|
9
|
+
await after.bind(TestContext.context)();
|
|
10
|
+
}
|
|
11
|
+
TestContext.releaseContext();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
34
14
|
//# sourceMappingURL=withAspect.js.map
|
package/lib/withAspect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withAspect.js","sourceRoot":"","sources":["../src/withAspect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withAspect.js","sourceRoot":"","sources":["../src/withAspect.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,eAAe,CACb,UAAmC,EACnC,SAAiC,EACjC,EAAE,CAAC,CACH,CACE,MAAmB,EACnB,KAAmB,EACnB,EAAE;IACF,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,WAAW,CAAC,aAAa,EAAE,CAAC;QAE5B,MAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAY,CAAS,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,IAAI,KAAK,EAAE,CAAC;YACV,MAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,OAAY,CAAS,EAAE,CAAC;QACxD,CAAC;QAED,WAAW,CAAC,cAAc,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-gwt",
|
|
3
|
-
"version": "0.0.1",
|
|
3
|
+
"version": "0.0.3-alpha.1",
|
|
4
4
|
"description": "A small library to help Vitest support given-when-then style testing without a bunch of overhead",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"src",
|
|
10
10
|
"!**/*.spec.ts"
|
|
11
11
|
],
|
|
12
|
+
"type": "module",
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "wireit",
|
|
14
15
|
"test": "wireit",
|
|
@@ -69,6 +70,8 @@
|
|
|
69
70
|
"homepage": "https://github.com/devzeebo/vitest-gwt#readme",
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@react-ddd/eslint-config": "^0.3.1",
|
|
73
|
+
"@tsconfig/node20": "^20.1.4",
|
|
74
|
+
"@tsconfig/node22": "^22.0.0",
|
|
72
75
|
"@types/lodash": "^4.14.198",
|
|
73
76
|
"@types/node": "^20.6.0",
|
|
74
77
|
"@vitest/coverage-v8": "^2.0.5",
|
|
@@ -79,6 +82,7 @@
|
|
|
79
82
|
"wireit": "^0.13.0"
|
|
80
83
|
},
|
|
81
84
|
"dependencies": {
|
|
82
|
-
"
|
|
85
|
+
"default-import": "^2.0.1",
|
|
86
|
+
"gwt-runner": "^3.0.0-esm.0001"
|
|
83
87
|
}
|
|
84
88
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
afterEach as vitestAfterEach,
|
|
5
5
|
} from 'vitest';
|
|
6
6
|
import gwtRunner, { TestContext } from 'gwt-runner';
|
|
7
|
-
import withAspectBuilder from './withAspect';
|
|
7
|
+
import withAspectBuilder from './withAspect.js';
|
|
8
8
|
|
|
9
9
|
export default gwtRunner(vitest);
|
|
10
10
|
export { TestContext };
|
package/src/withAspect.ts
CHANGED
|
@@ -4,13 +4,13 @@ import type {
|
|
|
4
4
|
} from 'vitest';
|
|
5
5
|
import { TestContext } from 'gwt-runner';
|
|
6
6
|
|
|
7
|
-
type Callback<T
|
|
7
|
+
type Callback<T,> = (this: T) => any;
|
|
8
8
|
|
|
9
9
|
export default (
|
|
10
10
|
beforeEach: typeof vitestBeforeEach,
|
|
11
11
|
afterEach: typeof vitestAfterEach,
|
|
12
12
|
) => (
|
|
13
|
-
<T
|
|
13
|
+
<T,>(
|
|
14
14
|
before: Callback<T>,
|
|
15
15
|
after?: Callback<T>,
|
|
16
16
|
) => {
|