@cronn/lib-file-snapshots 0.19.1 → 1.0.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.mjs +9 -9
- package/package.json +10 -8
package/dist/index.mjs
CHANGED
|
@@ -10,17 +10,17 @@ const EMOJI_REGEXP = /(?!(\*|#|\d))[\p{Extended_Pictographic}\p{Emoji_Component}
|
|
|
10
10
|
function normalizeFileName(testName) {
|
|
11
11
|
return testName.replaceAll(EMOJI_REGEXP, "").replaceAll(/[+*%~<>?!$#'"`|\\/()[\]{}]/g, "").replaceAll(/[\s.:,;]+/g, "_").replaceAll(/_{2,}/g, "_");
|
|
12
12
|
}
|
|
13
|
-
function readSnapshotFile(
|
|
14
|
-
const contents = fs.readFileSync(
|
|
13
|
+
function readSnapshotFile(filePath) {
|
|
14
|
+
const contents = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
15
15
|
if (os.EOL === NEW_LINE_SEPARATOR) return contents;
|
|
16
16
|
return contents.replace(new RegExp(os.EOL, "g"), NEW_LINE_SEPARATOR);
|
|
17
17
|
}
|
|
18
|
-
function writeSnapshotFile(
|
|
19
|
-
mkdirRecursive(path.dirname(
|
|
20
|
-
fs.writeFileSync(
|
|
18
|
+
function writeSnapshotFile(filePath, data) {
|
|
19
|
+
mkdirRecursive(path.dirname(filePath));
|
|
20
|
+
fs.writeFileSync(filePath, data, { encoding: "utf8" });
|
|
21
21
|
}
|
|
22
|
-
function mkdirRecursive(
|
|
23
|
-
fs.mkdirSync(
|
|
22
|
+
function mkdirRecursive(dirPath) {
|
|
23
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
24
24
|
}
|
|
25
25
|
function addTrailingNewLine(data) {
|
|
26
26
|
return `${data}${NEW_LINE_SEPARATOR}`;
|
|
@@ -124,9 +124,9 @@ var JsonSerializer = class {
|
|
|
124
124
|
return normalizedObject;
|
|
125
125
|
}
|
|
126
126
|
normalizeMap(value) {
|
|
127
|
-
return Array.from(value.entries()).reduce((object, [key,
|
|
127
|
+
return Array.from(value.entries()).reduce((object, [key, propertyValue]) => {
|
|
128
128
|
this.assertKeyType(key);
|
|
129
|
-
object[key] =
|
|
129
|
+
object[key] = propertyValue;
|
|
130
130
|
return object;
|
|
131
131
|
}, {});
|
|
132
132
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronn/lib-file-snapshots",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "The library agnostic core for testing file snapshots",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file snapshots"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/cronn/file-snapshots.git",
|
|
15
|
+
"url": "git+https://github.com/cronn/file-snapshots.git",
|
|
16
16
|
"directory": "packages/lib-file-snapshots"
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/cronn/file-snapshots",
|
|
@@ -43,16 +43,18 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"@arethetypeswrong/core": "0.18.2",
|
|
46
47
|
"@trivago/prettier-plugin-sort-imports": "6.0.2",
|
|
47
|
-
"@
|
|
48
|
+
"@typescript/native-preview": "7.0.0-dev.20260218.1",
|
|
49
|
+
"@types/node": "24.10.13",
|
|
48
50
|
"@vitest/coverage-v8": "4.0.18",
|
|
49
|
-
"eslint": "
|
|
51
|
+
"eslint": "10.0.1",
|
|
50
52
|
"eslint-config-prettier": "10.1.8",
|
|
51
|
-
"eslint-plugin-unused-imports": "4.
|
|
53
|
+
"eslint-plugin-unused-imports": "4.4.1",
|
|
52
54
|
"prettier": "3.8.1",
|
|
55
|
+
"publint": "0.3.17",
|
|
53
56
|
"tsdown": "0.20.3",
|
|
54
|
-
"typescript": "
|
|
55
|
-
"typescript-eslint": "8.54.0",
|
|
57
|
+
"typescript-eslint": "8.56.0",
|
|
56
58
|
"vitest": "4.0.18",
|
|
57
59
|
"@cronn/shared-configs": "0.0.0"
|
|
58
60
|
},
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
"lint:fix": "eslint src/ --max-warnings=0 --fix",
|
|
62
64
|
"test": "vitest run",
|
|
63
65
|
"test:coverage": "vitest run --coverage",
|
|
64
|
-
"compile": "
|
|
66
|
+
"compile": "tsgo",
|
|
65
67
|
"build": "tsdown"
|
|
66
68
|
}
|
|
67
69
|
}
|