@cronn/lib-file-snapshots 0.8.0 → 0.10.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 -0
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ interface JsonSerializerOptions {
|
|
|
39
39
|
type JsonNormalizer = (value: unknown, context: JsonNormalizerContext) => unknown;
|
|
40
40
|
interface JsonNormalizerContext {
|
|
41
41
|
key?: string;
|
|
42
|
+
index?: number;
|
|
42
43
|
}
|
|
43
44
|
declare class JsonSerializer implements SnapshotSerializer {
|
|
44
45
|
private readonly includeUndefinedObjectProperties;
|
package/dist/index.js
CHANGED
|
@@ -100,7 +100,7 @@ var JsonSerializer = class {
|
|
|
100
100
|
}
|
|
101
101
|
normalizeArray(value) {
|
|
102
102
|
return value.map(
|
|
103
|
-
(item, index) => this.normalizeValueRecursive(item, {
|
|
103
|
+
(item, index) => this.normalizeValueRecursive(item, { index })
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
normalizeObject(value) {
|
|
@@ -213,8 +213,9 @@ import * as path from "path";
|
|
|
213
213
|
// src/utils/file.ts
|
|
214
214
|
import fs from "fs";
|
|
215
215
|
var NEW_LINE_SEPARATOR = "\n";
|
|
216
|
+
var EMOJI_REGEXP = /(?!(\*|#|\d))[\p{Extended_Pictographic}\p{Emoji_Component}]|[\u0030-\u0039]\ufe0f?[\u20e3]|[\u002A\u0023]?\ufe0f?[\u20e3]/gu;
|
|
216
217
|
function normalizeFileName(testName) {
|
|
217
|
-
return testName.replaceAll(/[+*%~<>?!$#'"`|\\/()[\]{}]/g, "").replaceAll(/[\s.:,;]+/g, "_").replaceAll(/_{2,}/g, "_");
|
|
218
|
+
return testName.replaceAll(EMOJI_REGEXP, "").replaceAll(/[+*%~<>?!$#'"`|\\/()[\]{}]/g, "").replaceAll(/[\s.:,;]+/g, "_").replaceAll(/_{2,}/g, "_");
|
|
218
219
|
}
|
|
219
220
|
function mkdirRecursive(path2) {
|
|
220
221
|
fs.mkdirSync(path2, { recursive: true });
|