@vitest/snapshot 1.0.0-beta.3 → 1.0.0-beta.4
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 +1 -1
- package/dist/index.js +5 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ const environment = new NodeSnapshotEnvironment()
|
|
|
22
22
|
// you need to implement this yourselves,
|
|
23
23
|
// this depends on your runner
|
|
24
24
|
function getCurrentFilepath() {
|
|
25
|
-
return '/file.spec.
|
|
25
|
+
return '/file.spec.js'
|
|
26
26
|
}
|
|
27
27
|
function getCurrentTestName() {
|
|
28
28
|
return 'test1'
|
package/dist/index.js
CHANGED
|
@@ -1358,7 +1358,7 @@ ${JSON.stringify(stacks)}`
|
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
1360
1360
|
|
|
1361
|
-
function createMismatchError(message, actual, expected) {
|
|
1361
|
+
function createMismatchError(message, expand, actual, expected) {
|
|
1362
1362
|
const error = new Error(message);
|
|
1363
1363
|
Object.defineProperty(error, "actual", {
|
|
1364
1364
|
value: actual,
|
|
@@ -1372,6 +1372,7 @@ function createMismatchError(message, actual, expected) {
|
|
|
1372
1372
|
configurable: true,
|
|
1373
1373
|
writable: true
|
|
1374
1374
|
});
|
|
1375
|
+
Object.defineProperty(error, "diffOptions", { value: { expand } });
|
|
1375
1376
|
return error;
|
|
1376
1377
|
}
|
|
1377
1378
|
class SnapshotClient {
|
|
@@ -1412,7 +1413,7 @@ class SnapshotClient {
|
|
|
1412
1413
|
(_a = this.snapshotState) == null ? void 0 : _a.markSnapshotsAsCheckedForTest(name);
|
|
1413
1414
|
}
|
|
1414
1415
|
assert(options) {
|
|
1415
|
-
var _a, _b;
|
|
1416
|
+
var _a, _b, _c, _d;
|
|
1416
1417
|
const {
|
|
1417
1418
|
filepath = this.filepath,
|
|
1418
1419
|
name = this.name,
|
|
@@ -1433,7 +1434,7 @@ class SnapshotClient {
|
|
|
1433
1434
|
try {
|
|
1434
1435
|
const pass2 = ((_b = (_a = this.options).isEqual) == null ? void 0 : _b.call(_a, received, properties)) ?? false;
|
|
1435
1436
|
if (!pass2)
|
|
1436
|
-
throw createMismatchError("Snapshot properties mismatched", received, properties);
|
|
1437
|
+
throw createMismatchError("Snapshot properties mismatched", (_c = this.snapshotState) == null ? void 0 : _c.expand, received, properties);
|
|
1437
1438
|
else
|
|
1438
1439
|
received = deepMergeSnapshot(received, properties);
|
|
1439
1440
|
} catch (err) {
|
|
@@ -1455,7 +1456,7 @@ class SnapshotClient {
|
|
|
1455
1456
|
rawSnapshot
|
|
1456
1457
|
});
|
|
1457
1458
|
if (!pass)
|
|
1458
|
-
throw createMismatchError(`Snapshot \`${key || "unknown"}\` mismatched`, actual == null ? void 0 : actual.trim(), expected == null ? void 0 : expected.trim());
|
|
1459
|
+
throw createMismatchError(`Snapshot \`${key || "unknown"}\` mismatched`, (_d = this.snapshotState) == null ? void 0 : _d.expand, actual == null ? void 0 : actual.trim(), expected == null ? void 0 : expected.trim());
|
|
1459
1460
|
}
|
|
1460
1461
|
async assertRaw(options) {
|
|
1461
1462
|
if (!options.rawSnapshot)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/snapshot",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.4",
|
|
5
5
|
"description": "Vitest snapshot manager",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/natural-compare": "^1.4.1",
|
|
47
47
|
"natural-compare": "^1.4.0",
|
|
48
|
-
"@vitest/utils": "1.0.0-beta.
|
|
48
|
+
"@vitest/utils": "1.0.0-beta.4"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "rimraf dist && rollup -c",
|