@schmock/core 2.2.3 → 2.3.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/binary.d.ts +8 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +9 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +60 -29
- package/dist/http-helpers.d.ts +15 -3
- package/dist/http-helpers.d.ts.map +1 -1
- package/dist/http-helpers.js +24 -6
- package/dist/index.d.ts +90 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/interceptor.d.ts.map +1 -1
- package/dist/interceptor.js +71 -20
- package/dist/plugin-pipeline.d.ts +11 -4
- package/dist/plugin-pipeline.d.ts.map +1 -1
- package/dist/plugin-pipeline.js +98 -35
- package/dist/response-parser.d.ts.map +1 -1
- package/dist/response-parser.js +47 -17
- package/package.json +5 -3
- package/src/binary.test.ts +126 -0
- package/src/binary.ts +11 -0
- package/src/builder.ts +82 -35
- package/src/http-helpers.test.ts +39 -0
- package/src/http-helpers.ts +46 -10
- package/src/index.ts +1 -0
- package/src/interceptor.test.ts +197 -0
- package/src/interceptor.ts +215 -128
- package/src/parser.property.test.ts +91 -55
- package/src/plugin-pipeline.ts +150 -45
- package/src/plugin-system.test.ts +95 -0
- package/src/response-parser.ts +58 -19
- package/src/server.test.ts +81 -12
- package/src/steps/async-support.steps.ts +29 -8
- package/src/steps/audit-onerror-tuple.steps.ts +14 -30
- package/src/steps/error-handling.steps.ts +463 -253
- package/src/steps/fetch-interceptor.steps.ts +457 -0
- package/src/steps/http-methods.steps.ts +19 -8
- package/src/steps/lifecycle-events.steps.ts +50 -43
- package/src/steps/performance-reliability.steps.ts +78 -411
- package/src/steps/plugin-integration.steps.ts +54 -0
- package/src/steps/request-history.steps.ts +412 -230
- package/src/steps/standalone-server.steps.ts +7 -13
- package/src/steps/state-concurrency.steps.ts +142 -714
- package/src/steps/interceptor.steps.ts +0 -260
- package/src/steps/stateful-workflows.steps.ts +0 -353
|
@@ -4,11 +4,15 @@ import { schmock } from "../index";
|
|
|
4
4
|
|
|
5
5
|
const feature = await loadFeature("../../features/standalone-server.feature");
|
|
6
6
|
|
|
7
|
-
describeFeature(feature, ({ Scenario }) => {
|
|
7
|
+
describeFeature(feature, ({ Scenario, AfterEachScenario }) => {
|
|
8
8
|
let mock: Schmock.CallableMockInstance;
|
|
9
9
|
let serverInfo: Schmock.ServerInfo;
|
|
10
10
|
let httpResponse: Response;
|
|
11
11
|
|
|
12
|
+
AfterEachScenario(() => {
|
|
13
|
+
mock?.close();
|
|
14
|
+
});
|
|
15
|
+
|
|
12
16
|
function baseUrl(): string {
|
|
13
17
|
return `http://${serverInfo.hostname}:${serverInfo.port}`;
|
|
14
18
|
}
|
|
@@ -49,12 +53,7 @@ describeFeature(feature, ({ Scenario }) => {
|
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
Then("the server should not be running", async () => {
|
|
52
|
-
|
|
53
|
-
await fetch(`${baseUrl()}/hello`);
|
|
54
|
-
expect.unreachable("Should not be able to connect");
|
|
55
|
-
} catch {
|
|
56
|
-
// Connection refused — server is down
|
|
57
|
-
}
|
|
56
|
+
await expect(fetch(`${baseUrl()}/hello`)).rejects.toBeDefined();
|
|
58
57
|
});
|
|
59
58
|
});
|
|
60
59
|
|
|
@@ -222,12 +221,7 @@ describeFeature(feature, ({ Scenario }) => {
|
|
|
222
221
|
});
|
|
223
222
|
|
|
224
223
|
Then("the server should not be running", async () => {
|
|
225
|
-
|
|
226
|
-
await fetch(`${baseUrl()}/hello`);
|
|
227
|
-
expect.unreachable("Should not be able to connect");
|
|
228
|
-
} catch {
|
|
229
|
-
// Connection refused — server is down
|
|
230
|
-
}
|
|
224
|
+
await expect(fetch(`${baseUrl()}/hello`)).rejects.toBeDefined();
|
|
231
225
|
});
|
|
232
226
|
});
|
|
233
227
|
});
|