@pact-foundation/pact 13.1.3 → 13.1.4
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [13.1.4](https://github.com/pact-foundation/pact-js/compare/v13.1.3...v13.1.4) (2024-10-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Fixes and Improvements
|
|
9
|
+
|
|
10
|
+
* support async afterEach hook ([8c7cef6](https://github.com/pact-foundation/pact-js/commit/8c7cef6cb73633dbc68996bf4ba4b0e7613682b6)), closes [#1241](https://github.com/pact-foundation/pact-js/issues/1241)
|
|
11
|
+
|
|
5
12
|
### [13.1.3](https://github.com/pact-foundation/pact-js/compare/v13.1.2...v13.1.3) (2024-09-12)
|
|
6
13
|
|
|
7
14
|
|
package/package.json
CHANGED
|
@@ -42,14 +42,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.registerAfterHook = exports.registerBeforeHook = void 0;
|
|
43
43
|
var logger_1 = __importDefault(require("../../../common/logger"));
|
|
44
44
|
var registerBeforeHook = function (app, config, stateSetupPath) {
|
|
45
|
+
if (config.beforeEach)
|
|
46
|
+
logger_1.default.trace("registered 'beforeEach' hook");
|
|
45
47
|
app.use(function (req, res, next) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
48
|
var e_1;
|
|
47
49
|
return __generator(this, function (_a) {
|
|
48
50
|
switch (_a.label) {
|
|
49
51
|
case 0:
|
|
50
|
-
if (!(config.beforeEach
|
|
51
|
-
logger_1.default.trace("registered 'beforeEach' hook");
|
|
52
|
-
if (!(req.path === stateSetupPath)) return [3 /*break*/, 4];
|
|
52
|
+
if (!(req.path === stateSetupPath && config.beforeEach)) return [3 /*break*/, 5];
|
|
53
53
|
logger_1.default.debug("executing 'beforeEach' hook");
|
|
54
54
|
_a.label = 1;
|
|
55
55
|
case 1:
|
|
@@ -57,6 +57,7 @@ var registerBeforeHook = function (app, config, stateSetupPath) {
|
|
|
57
57
|
return [4 /*yield*/, config.beforeEach()];
|
|
58
58
|
case 2:
|
|
59
59
|
_a.sent();
|
|
60
|
+
next();
|
|
60
61
|
return [3 /*break*/, 4];
|
|
61
62
|
case 3:
|
|
62
63
|
e_1 = _a.sent();
|
|
@@ -64,24 +65,25 @@ var registerBeforeHook = function (app, config, stateSetupPath) {
|
|
|
64
65
|
logger_1.default.debug("Stack trace was: ".concat(e_1.stack));
|
|
65
66
|
next(new Error("error executing 'beforeEach' hook: ".concat(e_1.message)));
|
|
66
67
|
return [3 /*break*/, 4];
|
|
67
|
-
case 4:
|
|
68
|
+
case 4: return [3 /*break*/, 6];
|
|
69
|
+
case 5:
|
|
68
70
|
next();
|
|
69
|
-
|
|
71
|
+
_a.label = 6;
|
|
72
|
+
case 6: return [2 /*return*/];
|
|
70
73
|
}
|
|
71
74
|
});
|
|
72
75
|
}); });
|
|
73
76
|
};
|
|
74
77
|
exports.registerBeforeHook = registerBeforeHook;
|
|
75
78
|
var registerAfterHook = function (app, config, stateSetupPath) {
|
|
79
|
+
if (config.afterEach)
|
|
80
|
+
logger_1.default.trace("registered 'afterEach' hook");
|
|
76
81
|
app.use(function (req, res, next) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
82
|
var e_2;
|
|
78
83
|
return __generator(this, function (_a) {
|
|
79
84
|
switch (_a.label) {
|
|
80
85
|
case 0:
|
|
81
|
-
if (!(
|
|
82
|
-
logger_1.default.trace("registered 'afterEach' hook");
|
|
83
|
-
next();
|
|
84
|
-
if (!(req.path !== stateSetupPath)) return [3 /*break*/, 4];
|
|
86
|
+
if (!(req.path !== stateSetupPath && config.afterEach)) return [3 /*break*/, 5];
|
|
85
87
|
logger_1.default.debug("executing 'afterEach' hook");
|
|
86
88
|
_a.label = 1;
|
|
87
89
|
case 1:
|
|
@@ -89,6 +91,7 @@ var registerAfterHook = function (app, config, stateSetupPath) {
|
|
|
89
91
|
return [4 /*yield*/, config.afterEach()];
|
|
90
92
|
case 2:
|
|
91
93
|
_a.sent();
|
|
94
|
+
next();
|
|
92
95
|
return [3 /*break*/, 4];
|
|
93
96
|
case 3:
|
|
94
97
|
e_2 = _a.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../src/dsl/verifier/proxy/hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kEAA4C;AAGrC,IAAM,kBAAkB,GAAG,UAChC,GAAoB,EACpB,MAAoB,EACpB,cAAsB;IAEtB,GAAG,CAAC,GAAG,CAAC,UAAO,GAAG,EAAE,GAAG,EAAE,IAAI;;;;;yBACvB,CAAA,
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../../src/dsl/verifier/proxy/hooks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kEAA4C;AAGrC,IAAM,kBAAkB,GAAG,UAChC,GAAoB,EACpB,MAAoB,EACpB,cAAsB;IAEtB,IAAI,MAAM,CAAC,UAAU;QAAE,gBAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpE,GAAG,CAAC,GAAG,CAAC,UAAO,GAAG,EAAE,GAAG,EAAE,IAAI;;;;;yBACvB,CAAA,GAAG,CAAC,IAAI,KAAK,cAAc,IAAI,MAAM,CAAC,UAAU,CAAA,EAAhD,wBAAgD;oBAClD,gBAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;;;;oBAE1C,qBAAM,MAAM,CAAC,UAAU,EAAE,EAAA;;oBAAzB,SAAyB,CAAC;oBAC1B,IAAI,EAAE,CAAC;;;;oBAEP,gBAAM,CAAC,KAAK,CAAC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