@cronn/lib-file-snapshots 0.11.0 → 0.12.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 CHANGED
@@ -115,7 +115,6 @@ interface ValidationFileMatcherConfig {
115
115
  }
116
116
  type SnapshotNamingStrategy = "file" | "fileSuffix";
117
117
  interface ValidationFileMatcherResult {
118
- isValidationFileMissing: boolean;
119
118
  actual: string;
120
119
  expected: string;
121
120
  outputFilePath: string;
@@ -129,6 +128,7 @@ declare class ValidationFileMatcher {
129
128
  private readonly filePaths;
130
129
  private readonly validationFile;
131
130
  constructor(config: ValidationFileMatcherConfig);
131
+ get isValidationFileMissing(): boolean;
132
132
  matchFileSnapshot(actual: unknown): ValidationFileMatcherResult;
133
133
  private buildFilePaths;
134
134
  private applyNamingStrategy;
package/dist/index.js CHANGED
@@ -240,6 +240,9 @@ var ValidationFileMatcher = class {
240
240
  this.filePaths = this.buildFilePaths(config);
241
241
  this.validationFile = this.readValidationFile();
242
242
  }
243
+ get isValidationFileMissing() {
244
+ return this.validationFile === void 0;
245
+ }
243
246
  matchFileSnapshot(actual) {
244
247
  if (!this.serializer.canSerialize(actual)) {
245
248
  throw new Error(`Cannot serialize value of type ${typeof actual}`);
@@ -247,13 +250,11 @@ var ValidationFileMatcher = class {
247
250
  const serializedActual = this.serializer.serialize(actual);
248
251
  if (this.validationFile === void 0) {
249
252
  return this.createMatcherResult({
250
- isValidationFileMissing: true,
251
253
  actual: serializedActual,
252
254
  expected: addMissingFileMarker(serializedActual)
253
255
  });
254
256
  }
255
257
  return this.createMatcherResult({
256
- isValidationFileMissing: false,
257
258
  actual: serializedActual,
258
259
  expected: this.validationFile
259
260
  });
@@ -295,15 +296,14 @@ var ValidationFileMatcher = class {
295
296
  return readSnapshotFile(validationFilePath);
296
297
  }
297
298
  createMatcherResult(params) {
298
- const { isValidationFileMissing, actual, expected } = params;
299
+ const { actual, expected } = params;
299
300
  const { outputFilePath, validationFilePath } = this.filePaths;
300
301
  return {
301
- isValidationFileMissing,
302
302
  actual,
303
303
  expected,
304
304
  outputFilePath,
305
305
  validationFilePath,
306
- message: () => isValidationFileMissing ? `Missing validation file '${validationFilePath}'` : `Output file '${outputFilePath}'
306
+ message: () => this.isValidationFileMissing ? `Missing validation file '${validationFilePath}'` : `Output file '${outputFilePath}'
307
307
  does not match validation file '${validationFilePath}'`,
308
308
  writeFileSnapshots: () => this.writeFileSnapshots(params)
309
309
  };
@@ -312,7 +312,7 @@ does not match validation file '${validationFilePath}'`,
312
312
  const { actual, expected } = matcherResult;
313
313
  const { outputFilePath, validationFilePath } = this.filePaths;
314
314
  writeSnapshotFile(outputFilePath, actual);
315
- if (matcherResult.isValidationFileMissing) {
315
+ if (this.isValidationFileMissing) {
316
316
  writeSnapshotFile(validationFilePath, expected);
317
317
  }
318
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronn/lib-file-snapshots",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "The library agnostic core for testing file snapshots",
5
5
  "keywords": [
6
6
  "file snapshots"
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "homepage": "https://github.com/cronn/file-snapshots",
19
19
  "engines": {
20
- "node": ">=22",
20
+ "node": ">=22.18",
21
21
  "pnpm": ">=10"
22
22
  },
23
23
  "type": "module",
@@ -38,7 +38,6 @@
38
38
  "eslint": "9.32.0",
39
39
  "eslint-config-prettier": "10.1.8",
40
40
  "eslint-plugin-unused-imports": "4.1.4",
41
- "jiti": "2.5.1",
42
41
  "prettier": "3.6.2",
43
42
  "tsup": "8.5.0",
44
43
  "typescript": "5.8.3",