@relaybus/testing 0.4.0 → 0.4.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/README.md +18 -3
- package/dist/chunk-IOWTZMTG.cjs +230 -0
- package/dist/chunk-IOWTZMTG.cjs.map +1 -0
- package/dist/chunk-ZZZXYZJ3.js +222 -0
- package/dist/chunk-ZZZXYZJ3.js.map +1 -0
- package/dist/codec-contract.cjs +36 -0
- package/dist/codec-contract.cjs.map +1 -0
- package/dist/codec-contract.d.cts +178 -0
- package/dist/codec-contract.d.ts +178 -0
- package/dist/codec-contract.js +3 -0
- package/dist/codec-contract.js.map +1 -0
- package/dist/index.cjs +89 -170
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -139
- package/dist/index.d.ts +6 -139
- package/dist/index.js +64 -170
- package/dist/index.js.map +1 -1
- package/dist/jest.cjs +56 -0
- package/dist/jest.cjs.map +1 -0
- package/dist/jest.d.cts +10 -0
- package/dist/jest.d.ts +10 -0
- package/dist/jest.js +26 -0
- package/dist/jest.js.map +1 -0
- package/package.json +40 -4
package/dist/jest.cjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkIOWTZMTG_cjs = require('./chunk-IOWTZMTG.cjs');
|
|
4
|
+
|
|
5
|
+
// src/jest.ts
|
|
6
|
+
function globalFramework() {
|
|
7
|
+
const scope = globalThis;
|
|
8
|
+
if (typeof scope.describe !== "function" || typeof scope.it !== "function") {
|
|
9
|
+
throw new Error(
|
|
10
|
+
"@relaybus/testing/jest needs the describe and it globals of Jest; with another runner use registerKafkaCodecContract or registerRabbitMqCodecContract from @relaybus/testing/codec-contract"
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
describe: scope.describe,
|
|
15
|
+
it: scope.it
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function kafkaCodecContract(name, options) {
|
|
19
|
+
chunkIOWTZMTG_cjs.registerKafkaCodecContract(globalFramework(), { name, options });
|
|
20
|
+
}
|
|
21
|
+
function rabbitMqCodecContract(name, options) {
|
|
22
|
+
chunkIOWTZMTG_cjs.registerRabbitMqCodecContract(globalFramework(), { name, options });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, "CodecContractError", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkIOWTZMTG_cjs.CodecContractError; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "assertKafkaCodecCase", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkIOWTZMTG_cjs.assertKafkaCodecCase; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "assertRabbitMqCodecCase", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkIOWTZMTG_cjs.assertRabbitMqCodecCase; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "kafkaCodecMismatches", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkIOWTZMTG_cjs.kafkaCodecMismatches; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "rabbitMqCodecMismatches", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkIOWTZMTG_cjs.rabbitMqCodecMismatches; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "registerKafkaCodecContract", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkIOWTZMTG_cjs.registerKafkaCodecContract; }
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "registerRabbitMqCodecContract", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chunkIOWTZMTG_cjs.registerRabbitMqCodecContract; }
|
|
52
|
+
});
|
|
53
|
+
exports.kafkaCodecContract = kafkaCodecContract;
|
|
54
|
+
exports.rabbitMqCodecContract = rabbitMqCodecContract;
|
|
55
|
+
//# sourceMappingURL=jest.cjs.map
|
|
56
|
+
//# sourceMappingURL=jest.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/jest.ts"],"names":["registerKafkaCodecContract","registerRabbitMqCodecContract"],"mappings":";;;;;AAcA,SAAS,eAAA,GAAiC;AACxC,EAAA,MAAM,KAAA,GAAQ,UAAA;AACd,EAAA,IAAI,OAAO,KAAA,CAAM,QAAA,KAAa,cAAc,OAAO,KAAA,CAAM,OAAO,UAAA,EAAY;AAC1E,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,UAAU,KAAA,CAAM,QAAA;AAAA,IAChB,IAAI,KAAA,CAAM;AAAA,GACZ;AACF;AAGO,SAAS,kBAAA,CAAmB,MAAc,OAAA,EAA0C;AACzF,EAAAA,4CAAA,CAA2B,eAAA,EAAgB,EAAG,EAAE,IAAA,EAAM,SAAS,CAAA;AACjE;AAGO,SAAS,qBAAA,CAAsB,MAAc,OAAA,EAA6C;AAC/F,EAAAC,+CAAA,CAA8B,eAAA,EAAgB,EAAG,EAAE,IAAA,EAAM,SAAS,CAAA;AACpE","file":"jest.cjs","sourcesContent":["import {\n registerKafkaCodecContract,\n type KafkaCodecContractOptions,\n} from './codec-contract/kafka.js';\nimport {\n registerRabbitMqCodecContract,\n type RabbitMqCodecContractOptions,\n} from './codec-contract/rabbitmq.js';\nimport type { TestFramework } from './codec-contract/framework.js';\n\n// The codec contract registered with the `describe` and `it` globals of Jest:\n// `@relaybus/testing/jest`. Imports no test framework, so it needs no Vitest.\n\n/** The `describe` and `it` globals; a clear error when the runner does not provide them. */\nfunction globalFramework(): TestFramework {\n const scope = globalThis as { readonly describe?: unknown; readonly it?: unknown };\n if (typeof scope.describe !== 'function' || typeof scope.it !== 'function') {\n throw new Error(\n '@relaybus/testing/jest needs the describe and it globals of Jest; with another runner use registerKafkaCodecContract or registerRabbitMqCodecContract from @relaybus/testing/codec-contract',\n );\n }\n return {\n describe: scope.describe as TestFramework['describe'],\n it: scope.it as TestFramework['it'],\n };\n}\n\n/** Registers one Jest test per captured Kafka record (see `registerKafkaCodecContract`). */\nexport function kafkaCodecContract(name: string, options: KafkaCodecContractOptions): void {\n registerKafkaCodecContract(globalFramework(), { name, options });\n}\n\n/** Registers one Jest test per captured RabbitMQ message (see `registerRabbitMqCodecContract`). */\nexport function rabbitMqCodecContract(name: string, options: RabbitMqCodecContractOptions): void {\n registerRabbitMqCodecContract(globalFramework(), { name, options });\n}\n\nexport * from './codec-contract/index.js';\n"]}
|
package/dist/jest.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KafkaCodecContractOptions, RabbitMqCodecContractOptions } from './codec-contract.cjs';
|
|
2
|
+
export { BodyComparison, CodecContractError, KafkaCapturedRecord, KafkaCodecCase, KafkaDeliveredRecord, KafkaWrittenRecord, RabbitMqCapturedMessage, RabbitMqCodecCase, RabbitMqDeliveredMessage, RabbitMqWrittenMessage, TestFramework, WireBytes, assertKafkaCodecCase, assertRabbitMqCodecCase, kafkaCodecMismatches, rabbitMqCodecMismatches, registerKafkaCodecContract, registerRabbitMqCodecContract } from './codec-contract.cjs';
|
|
3
|
+
import '@relaybus/core';
|
|
4
|
+
|
|
5
|
+
/** Registers one Jest test per captured Kafka record (see `registerKafkaCodecContract`). */
|
|
6
|
+
declare function kafkaCodecContract(name: string, options: KafkaCodecContractOptions): void;
|
|
7
|
+
/** Registers one Jest test per captured RabbitMQ message (see `registerRabbitMqCodecContract`). */
|
|
8
|
+
declare function rabbitMqCodecContract(name: string, options: RabbitMqCodecContractOptions): void;
|
|
9
|
+
|
|
10
|
+
export { KafkaCodecContractOptions, RabbitMqCodecContractOptions, kafkaCodecContract, rabbitMqCodecContract };
|
package/dist/jest.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KafkaCodecContractOptions, RabbitMqCodecContractOptions } from './codec-contract.js';
|
|
2
|
+
export { BodyComparison, CodecContractError, KafkaCapturedRecord, KafkaCodecCase, KafkaDeliveredRecord, KafkaWrittenRecord, RabbitMqCapturedMessage, RabbitMqCodecCase, RabbitMqDeliveredMessage, RabbitMqWrittenMessage, TestFramework, WireBytes, assertKafkaCodecCase, assertRabbitMqCodecCase, kafkaCodecMismatches, rabbitMqCodecMismatches, registerKafkaCodecContract, registerRabbitMqCodecContract } from './codec-contract.js';
|
|
3
|
+
import '@relaybus/core';
|
|
4
|
+
|
|
5
|
+
/** Registers one Jest test per captured Kafka record (see `registerKafkaCodecContract`). */
|
|
6
|
+
declare function kafkaCodecContract(name: string, options: KafkaCodecContractOptions): void;
|
|
7
|
+
/** Registers one Jest test per captured RabbitMQ message (see `registerRabbitMqCodecContract`). */
|
|
8
|
+
declare function rabbitMqCodecContract(name: string, options: RabbitMqCodecContractOptions): void;
|
|
9
|
+
|
|
10
|
+
export { KafkaCodecContractOptions, RabbitMqCodecContractOptions, kafkaCodecContract, rabbitMqCodecContract };
|
package/dist/jest.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { registerKafkaCodecContract, registerRabbitMqCodecContract } from './chunk-ZZZXYZJ3.js';
|
|
2
|
+
export { CodecContractError, assertKafkaCodecCase, assertRabbitMqCodecCase, kafkaCodecMismatches, rabbitMqCodecMismatches, registerKafkaCodecContract, registerRabbitMqCodecContract } from './chunk-ZZZXYZJ3.js';
|
|
3
|
+
|
|
4
|
+
// src/jest.ts
|
|
5
|
+
function globalFramework() {
|
|
6
|
+
const scope = globalThis;
|
|
7
|
+
if (typeof scope.describe !== "function" || typeof scope.it !== "function") {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"@relaybus/testing/jest needs the describe and it globals of Jest; with another runner use registerKafkaCodecContract or registerRabbitMqCodecContract from @relaybus/testing/codec-contract"
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
describe: scope.describe,
|
|
14
|
+
it: scope.it
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function kafkaCodecContract(name, options) {
|
|
18
|
+
registerKafkaCodecContract(globalFramework(), { name, options });
|
|
19
|
+
}
|
|
20
|
+
function rabbitMqCodecContract(name, options) {
|
|
21
|
+
registerRabbitMqCodecContract(globalFramework(), { name, options });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { kafkaCodecContract, rabbitMqCodecContract };
|
|
25
|
+
//# sourceMappingURL=jest.js.map
|
|
26
|
+
//# sourceMappingURL=jest.js.map
|
package/dist/jest.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/jest.ts"],"names":[],"mappings":";;;;AAcA,SAAS,eAAA,GAAiC;AACxC,EAAA,MAAM,KAAA,GAAQ,UAAA;AACd,EAAA,IAAI,OAAO,KAAA,CAAM,QAAA,KAAa,cAAc,OAAO,KAAA,CAAM,OAAO,UAAA,EAAY;AAC1E,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,UAAU,KAAA,CAAM,QAAA;AAAA,IAChB,IAAI,KAAA,CAAM;AAAA,GACZ;AACF;AAGO,SAAS,kBAAA,CAAmB,MAAc,OAAA,EAA0C;AACzF,EAAA,0BAAA,CAA2B,eAAA,EAAgB,EAAG,EAAE,IAAA,EAAM,SAAS,CAAA;AACjE;AAGO,SAAS,qBAAA,CAAsB,MAAc,OAAA,EAA6C;AAC/F,EAAA,6BAAA,CAA8B,eAAA,EAAgB,EAAG,EAAE,IAAA,EAAM,SAAS,CAAA;AACpE","file":"jest.js","sourcesContent":["import {\n registerKafkaCodecContract,\n type KafkaCodecContractOptions,\n} from './codec-contract/kafka.js';\nimport {\n registerRabbitMqCodecContract,\n type RabbitMqCodecContractOptions,\n} from './codec-contract/rabbitmq.js';\nimport type { TestFramework } from './codec-contract/framework.js';\n\n// The codec contract registered with the `describe` and `it` globals of Jest:\n// `@relaybus/testing/jest`. Imports no test framework, so it needs no Vitest.\n\n/** The `describe` and `it` globals; a clear error when the runner does not provide them. */\nfunction globalFramework(): TestFramework {\n const scope = globalThis as { readonly describe?: unknown; readonly it?: unknown };\n if (typeof scope.describe !== 'function' || typeof scope.it !== 'function') {\n throw new Error(\n '@relaybus/testing/jest needs the describe and it globals of Jest; with another runner use registerKafkaCodecContract or registerRabbitMqCodecContract from @relaybus/testing/codec-contract',\n );\n }\n return {\n describe: scope.describe as TestFramework['describe'],\n it: scope.it as TestFramework['it'],\n };\n}\n\n/** Registers one Jest test per captured Kafka record (see `registerKafkaCodecContract`). */\nexport function kafkaCodecContract(name: string, options: KafkaCodecContractOptions): void {\n registerKafkaCodecContract(globalFramework(), { name, options });\n}\n\n/** Registers one Jest test per captured RabbitMQ message (see `registerRabbitMqCodecContract`). */\nexport function rabbitMqCodecContract(name: string, options: RabbitMqCodecContractOptions): void {\n registerRabbitMqCodecContract(globalFramework(), { name, options });\n}\n\nexport * from './codec-contract/index.js';\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relaybus/testing",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Testing utilities for relaybus: the EventStore contract suite, a FakeClock and an in-memory transport for deterministic tests of retries, delays and dead letters.",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Testing utilities for relaybus: the EventStore contract suite, a FakeClock and an in-memory transport for deterministic tests of retries, delays and dead letters, and a codec contract that runs under Vitest, Jest or any other test framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Berkcan Şavur <berkcansavur@gmail.com>",
|
|
7
7
|
"homepage": "https://berkcansavur.github.io/relaybus/packages/testing",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"fake-clock",
|
|
20
20
|
"in-memory",
|
|
21
21
|
"vitest",
|
|
22
|
+
"jest",
|
|
22
23
|
"event-bus",
|
|
23
24
|
"transactional-outbox",
|
|
24
25
|
"outbox-pattern",
|
|
@@ -45,6 +46,26 @@
|
|
|
45
46
|
"default": "./dist/index.cjs"
|
|
46
47
|
}
|
|
47
48
|
},
|
|
49
|
+
"./codec-contract": {
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./dist/codec-contract.d.ts",
|
|
52
|
+
"default": "./dist/codec-contract.js"
|
|
53
|
+
},
|
|
54
|
+
"require": {
|
|
55
|
+
"types": "./dist/codec-contract.d.cts",
|
|
56
|
+
"default": "./dist/codec-contract.cjs"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"./jest": {
|
|
60
|
+
"import": {
|
|
61
|
+
"types": "./dist/jest.d.ts",
|
|
62
|
+
"default": "./dist/jest.js"
|
|
63
|
+
},
|
|
64
|
+
"require": {
|
|
65
|
+
"types": "./dist/jest.d.cts",
|
|
66
|
+
"default": "./dist/jest.cjs"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
48
69
|
"./package.json": "./package.json"
|
|
49
70
|
},
|
|
50
71
|
"files": [
|
|
@@ -61,10 +82,25 @@
|
|
|
61
82
|
},
|
|
62
83
|
"peerDependencies": {
|
|
63
84
|
"vitest": ">=3.0.0",
|
|
64
|
-
"@relaybus/core": "^0.4.
|
|
85
|
+
"@relaybus/core": "^0.4.1"
|
|
65
86
|
},
|
|
66
87
|
"devDependencies": {
|
|
67
|
-
"@relaybus/core": "0.4.
|
|
88
|
+
"@relaybus/core": "0.4.1"
|
|
89
|
+
},
|
|
90
|
+
"typesVersions": {
|
|
91
|
+
"*": {
|
|
92
|
+
"codec-contract": [
|
|
93
|
+
"dist/codec-contract.d.ts"
|
|
94
|
+
],
|
|
95
|
+
"jest": [
|
|
96
|
+
"dist/jest.d.ts"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"peerDependenciesMeta": {
|
|
101
|
+
"vitest": {
|
|
102
|
+
"optional": true
|
|
103
|
+
}
|
|
68
104
|
},
|
|
69
105
|
"scripts": {
|
|
70
106
|
"build": "tsup",
|