@cronn/lib-file-snapshots 0.3.0 → 0.4.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/index.d.ts +1 -8
- package/dist/index.js +0 -22
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -24,13 +24,6 @@ interface SnapshotSerializerResult {
|
|
|
24
24
|
fileExtension: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
declare class CompositeSerializer implements SnapshotSerializer {
|
|
28
|
-
private readonly serializers;
|
|
29
|
-
constructor(serializers: SnapshotSerializer[]);
|
|
30
|
-
canSerialize(value: unknown): boolean;
|
|
31
|
-
serialize(value: unknown): SnapshotSerializerResult;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
interface JsonSerializerOptions {
|
|
35
28
|
/**
|
|
36
29
|
* Serializes `undefined` properties in objects. By default, they are omitted.
|
|
@@ -117,4 +110,4 @@ declare class ValidationFileMatcher {
|
|
|
117
110
|
private writeFileSnapshots;
|
|
118
111
|
}
|
|
119
112
|
|
|
120
|
-
export {
|
|
113
|
+
export { JsonSerializer, type SnapshotSerializer, TextSerializer, ValidationFileMatcher };
|
package/dist/index.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
// src/serializers/composite-serializer.ts
|
|
2
|
-
var CompositeSerializer = class {
|
|
3
|
-
serializers;
|
|
4
|
-
constructor(serializers) {
|
|
5
|
-
this.serializers = serializers;
|
|
6
|
-
}
|
|
7
|
-
canSerialize(value) {
|
|
8
|
-
return this.serializers.some(
|
|
9
|
-
(serializer) => serializer.canSerialize(value)
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
serialize(value) {
|
|
13
|
-
for (const serializer of this.serializers) {
|
|
14
|
-
if (serializer.canSerialize(value)) {
|
|
15
|
-
return serializer.serialize(value);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
throw new Error(`Missing serializer for value of type ${typeof value}.`);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
1
|
// src/utils/guards.ts
|
|
23
2
|
function isArray(value) {
|
|
24
3
|
return Array.isArray(value);
|
|
@@ -288,7 +267,6 @@ does not match validation file '${validationFile}'`
|
|
|
288
267
|
}
|
|
289
268
|
};
|
|
290
269
|
export {
|
|
291
|
-
CompositeSerializer,
|
|
292
270
|
JsonSerializer,
|
|
293
271
|
TextSerializer,
|
|
294
272
|
ValidationFileMatcher
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronn/lib-file-snapshots",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The library agnostic core for testing file snapshots",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file snapshots"
|
|
7
7
|
],
|
|
8
8
|
"bugs": {
|
|
9
|
-
"url": "https://github.com/cronn/
|
|
9
|
+
"url": "https://github.com/cronn/file-snapshots/issues"
|
|
10
10
|
},
|
|
11
11
|
"author": "cronn",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/cronn/
|
|
15
|
+
"url": "https://github.com/cronn/file-snapshots.git",
|
|
16
16
|
"directory": "packages/lib-file-snapshots"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://github.com/cronn/
|
|
18
|
+
"homepage": "https://github.com/cronn/file-snapshots",
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=22",
|
|
21
21
|
"pnpm": ">=10"
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@biomejs/biome": "1.9.4",
|
|
36
36
|
"@types/node": "22.15.30",
|
|
37
|
-
"@vitest/coverage-istanbul": "3.2.
|
|
37
|
+
"@vitest/coverage-istanbul": "3.2.4",
|
|
38
38
|
"tsup": "8.5.0",
|
|
39
39
|
"typescript": "5.8.3",
|
|
40
|
-
"vitest": "3.2.
|
|
40
|
+
"vitest": "3.2.4",
|
|
41
41
|
"@cronn/shared-configs": "0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|