jest-prettyhtml-matchers 1.17.14 → 1.17.16
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/create-formatter.js +2 -6
- package/dist/create-formatter.js.map +1 -1
- package/dist/create-prettyhtml-matchers.d.ts +2 -2
- package/dist/create-prettyhtml-matchers.js +9 -10
- package/dist/create-prettyhtml-matchers.js.map +1 -1
- package/dist/create-to-match-inline-prettyhtml-snapshot.js +20 -33
- package/dist/create-to-match-inline-prettyhtml-snapshot.js.map +1 -1
- package/dist/create-to-match-prettyhtml-snapshot.js +13 -15
- package/dist/create-to-match-prettyhtml-snapshot.js.map +1 -1
- package/package.json +22 -20
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# jest-prettyhtml-matchers
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/jest-prettyhtml-matchers)
|
|
4
|
-
[](https://github.com/tanem/jest-prettyhtml-matchers/actions?query=workflow%3ACI)
|
|
5
5
|
[](https://codecov.io/gh/tanem/jest-prettyhtml-matchers)
|
|
6
6
|
[](https://www.npmjs.com/package/jest-prettyhtml-matchers)
|
|
7
7
|
|
package/dist/create-formatter.js
CHANGED
|
@@ -4,11 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createFormatter = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return function (input) {
|
|
10
|
-
return (0, prettyhtml_1.default)(input, options).contents;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
7
|
+
const prettyhtml_1 = __importDefault(require("@starptech/prettyhtml"));
|
|
8
|
+
const createFormatter = (options) => (input) => (0, prettyhtml_1.default)(input, options).contents;
|
|
13
9
|
exports.createFormatter = createFormatter;
|
|
14
10
|
//# sourceMappingURL=create-formatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-formatter.js","sourceRoot":"","sources":["../src/create-formatter.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"create-formatter.js","sourceRoot":"","sources":["../src/create-formatter.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA8C;AAGvC,MAAM,eAAe,GAC1B,CAAC,OAA0B,EAAU,EAAE,CACvC,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,oBAAU,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAA;AAH1B,QAAA,eAAe,mBAGW"}
|
|
@@ -10,6 +10,6 @@ declare global {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export declare const createPrettyHtmlMatchers: (options?: PrettyHtmlOptions) => {
|
|
13
|
-
toMatchPrettyHtmlSnapshot: (this: any, received: string, options?:
|
|
14
|
-
toMatchInlinePrettyHtmlSnapshot: (this: any, received: string, options?:
|
|
13
|
+
toMatchPrettyHtmlSnapshot: (this: any, received: string, options?: PrettyHtmlOptions | string, hint?: string) => import("expect").ExpectationResult;
|
|
14
|
+
toMatchInlinePrettyHtmlSnapshot: (this: any, received: string, options?: PrettyHtmlOptions | string, inlineSnapshot?: string) => import("expect").ExpectationResult;
|
|
15
15
|
};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPrettyHtmlMatchers = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var toMatchInlinePrettyHtmlSnapshot = (0, create_to_match_inline_prettyhtml_snapshot_1.createToMatchInlinePrettyHtmlSnapshot)(format);
|
|
4
|
+
const create_formatter_1 = require("./create-formatter");
|
|
5
|
+
const create_to_match_inline_prettyhtml_snapshot_1 = require("./create-to-match-inline-prettyhtml-snapshot");
|
|
6
|
+
const create_to_match_prettyhtml_snapshot_1 = require("./create-to-match-prettyhtml-snapshot");
|
|
7
|
+
const createPrettyHtmlMatchers = (options = {}) => {
|
|
8
|
+
const format = (0, create_formatter_1.createFormatter)(options);
|
|
9
|
+
const toMatchPrettyHtmlSnapshot = (0, create_to_match_prettyhtml_snapshot_1.createToMatchPrettyHtmlSnapshot)(format);
|
|
10
|
+
const toMatchInlinePrettyHtmlSnapshot = (0, create_to_match_inline_prettyhtml_snapshot_1.createToMatchInlinePrettyHtmlSnapshot)(format);
|
|
12
11
|
return {
|
|
13
|
-
toMatchPrettyHtmlSnapshot
|
|
14
|
-
toMatchInlinePrettyHtmlSnapshot
|
|
12
|
+
toMatchPrettyHtmlSnapshot,
|
|
13
|
+
toMatchInlinePrettyHtmlSnapshot,
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
16
|
exports.createPrettyHtmlMatchers = createPrettyHtmlMatchers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-prettyhtml-matchers.js","sourceRoot":"","sources":["../src/create-prettyhtml-matchers.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"create-prettyhtml-matchers.js","sourceRoot":"","sources":["../src/create-prettyhtml-matchers.ts"],"names":[],"mappings":";;;AAAA,yDAAoD;AACpD,6GAAoG;AACpG,+FAAuF;AAiBhF,MAAM,wBAAwB,GAAG,CAAC,UAA6B,EAAE,EAAE,EAAE;IAC1E,MAAM,MAAM,GAAG,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAA;IACvC,MAAM,yBAAyB,GAAG,IAAA,qEAA+B,EAAC,MAAM,CAAC,CAAA;IACzE,MAAM,+BAA+B,GACnC,IAAA,kFAAqC,EAAC,MAAM,CAAC,CAAA;IAC/C,OAAO;QACL,yBAAyB;QACzB,+BAA+B;KAChC,CAAA;AACH,CAAC,CAAA;AATY,QAAA,wBAAwB,4BASpC"}
|
|
@@ -1,39 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.createToMatchInlinePrettyHtmlSnapshot = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return jest_snapshot_1.toMatchInlineSnapshot.call(newContext, format(received));
|
|
36
|
-
};
|
|
4
|
+
const jest_snapshot_1 = require("jest-snapshot");
|
|
5
|
+
const create_formatter_1 = require("./create-formatter");
|
|
6
|
+
const createToMatchInlinePrettyHtmlSnapshot = (format) => function toMatchInlinePrettyHtmlSnapshot(received, options, inlineSnapshot) {
|
|
7
|
+
if (typeof options === 'object') {
|
|
8
|
+
format = (0, create_formatter_1.createFormatter)(options);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
inlineSnapshot = options;
|
|
12
|
+
}
|
|
13
|
+
const error = new Error();
|
|
14
|
+
const newStack = error.stack
|
|
15
|
+
.split(/\n/)
|
|
16
|
+
.filter((_, index) => index !== 1)
|
|
17
|
+
.join('\n');
|
|
18
|
+
error.stack = newStack;
|
|
19
|
+
const newContext = Object.assign(Object.assign({}, this), { error });
|
|
20
|
+
if (inlineSnapshot) {
|
|
21
|
+
return jest_snapshot_1.toMatchInlineSnapshot.call(newContext, format(received), inlineSnapshot);
|
|
22
|
+
}
|
|
23
|
+
return jest_snapshot_1.toMatchInlineSnapshot.call(newContext, format(received));
|
|
37
24
|
};
|
|
38
25
|
exports.createToMatchInlinePrettyHtmlSnapshot = createToMatchInlinePrettyHtmlSnapshot;
|
|
39
26
|
//# sourceMappingURL=create-to-match-inline-prettyhtml-snapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-to-match-inline-prettyhtml-snapshot.js","sourceRoot":"","sources":["../src/create-to-match-inline-prettyhtml-snapshot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-to-match-inline-prettyhtml-snapshot.js","sourceRoot":"","sources":["../src/create-to-match-inline-prettyhtml-snapshot.ts"],"names":[],"mappings":";;;AAAA,iDAAqD;AACrD,yDAAoD;AAG7C,MAAM,qCAAqC,GAAG,CAAC,MAAc,EAAE,EAAE,CACtE,SAAS,+BAA+B,CAEtC,QAAgB,EAChB,OAAoC,EACpC,cAAuB;IAEvB,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,GAAG,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAA;IACnC,CAAC;SAAM,CAAC;QACN,cAAc,GAAG,OAAO,CAAA;IAC1B,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAA;IACzB,MAAM,QAAQ,GAAI,KAAK,CAAC,KAAgB;SACrC,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC;SACjC,IAAI,CAAC,IAAI,CAAC,CAAA;IACb,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAA;IAEtB,MAAM,UAAU,mCAAQ,IAAI,KAAE,KAAK,GAAE,CAAA;IAErC,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,qCAAqB,CAAC,IAAI,CAC/B,UAAU,EACV,MAAM,CAAC,QAAQ,CAAC,EAGhB,cAAc,CACf,CAAA;IACH,CAAC;IAED,OAAO,qCAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;AACjE,CAAC,CAAA;AAjCU,QAAA,qCAAqC,yCAiC/C"}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createToMatchPrettyHtmlSnapshot = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return jest_snapshot_1.toMatchSnapshot.call(this, format(received));
|
|
18
|
-
};
|
|
4
|
+
const jest_snapshot_1 = require("jest-snapshot");
|
|
5
|
+
const create_formatter_1 = require("./create-formatter");
|
|
6
|
+
const createToMatchPrettyHtmlSnapshot = (format) => function toMatchPrettyHtmlSnapshot(received, options, hint) {
|
|
7
|
+
if (typeof options === 'object') {
|
|
8
|
+
format = (0, create_formatter_1.createFormatter)(options);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
hint = options;
|
|
12
|
+
}
|
|
13
|
+
if (hint) {
|
|
14
|
+
return jest_snapshot_1.toMatchSnapshot.call(this, format(received), hint);
|
|
15
|
+
}
|
|
16
|
+
return jest_snapshot_1.toMatchSnapshot.call(this, format(received));
|
|
19
17
|
};
|
|
20
18
|
exports.createToMatchPrettyHtmlSnapshot = createToMatchPrettyHtmlSnapshot;
|
|
21
19
|
//# sourceMappingURL=create-to-match-prettyhtml-snapshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-to-match-prettyhtml-snapshot.js","sourceRoot":"","sources":["../src/create-to-match-prettyhtml-snapshot.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"create-to-match-prettyhtml-snapshot.js","sourceRoot":"","sources":["../src/create-to-match-prettyhtml-snapshot.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,yDAAoD;AAG7C,MAAM,+BAA+B,GAAG,CAAC,MAAc,EAAE,EAAE,CAChE,SAAS,yBAAyB,CAEhC,QAAgB,EAChB,OAAoC,EACpC,IAAa;IAEb,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,GAAG,IAAA,kCAAe,EAAC,OAAO,CAAC,CAAA;IACnC,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,OAAO,CAAA;IAChB,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QAGT,OAAO,+BAAe,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAA;IAC3D,CAAC;IAED,OAAO,+BAAe,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAA;AACrD,CAAC,CAAA;AApBU,QAAA,+BAA+B,mCAoBzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-prettyhtml-matchers",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.16",
|
|
4
4
|
"description": "Custom Jest snapshot matchers that use prettyhtml to format strings.",
|
|
5
5
|
"author": "Tane Morgan (https://github.com/tanem)",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,42 +24,44 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"check": "run-s check:*",
|
|
27
|
-
"check:format": "prettier --list-different \"**/*.{js,ts}\"",
|
|
27
|
+
"check:format": "prettier --list-different \"**/*.{mjs,js,ts}\"",
|
|
28
28
|
"check:types": "tsc --noEmit",
|
|
29
29
|
"clean": "run-s clean:*",
|
|
30
30
|
"clean:coverage": "del coverage",
|
|
31
31
|
"clean:dist": "del dist ",
|
|
32
32
|
"clean:test": "ts-node scripts/clean",
|
|
33
33
|
"compile": "tsc -p tsconfig.base.json",
|
|
34
|
-
"format": "prettier --write \"**/*.{js,ts}\"",
|
|
35
|
-
"lint": "eslint .
|
|
34
|
+
"format": "prettier --write \"**/*.{mjs,js,ts}\"",
|
|
35
|
+
"lint": "eslint .",
|
|
36
36
|
"release": "tanem-scripts release",
|
|
37
37
|
"test": "run-s check lint clean compile && ts-node scripts/test"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"jest": "^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0",
|
|
41
|
-
"jest-snapshot": "^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0"
|
|
40
|
+
"jest": "^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0 || ^30.0.0",
|
|
41
|
+
"jest-snapshot": "^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0 || ^30.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@starptech/prettyhtml": "^0.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
+
"@eslint/eslintrc": "3.3.3",
|
|
48
|
+
"@eslint/js": "9.39.2",
|
|
47
49
|
"@types/fs-extra": "11.0.4",
|
|
48
|
-
"@types/jest": "
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "
|
|
50
|
-
"@typescript-eslint/parser": "
|
|
50
|
+
"@types/jest": "30.0.0",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "8.53.1",
|
|
52
|
+
"@typescript-eslint/parser": "8.53.1",
|
|
51
53
|
"del": "6.1.1",
|
|
52
|
-
"del-cli": "
|
|
53
|
-
"eslint": "
|
|
54
|
-
"eslint-config-prettier": "
|
|
55
|
-
"fs-extra": "11.
|
|
56
|
-
"jest": "
|
|
57
|
-
"jest-snapshot": "
|
|
58
|
-
"npm-run-all2": "
|
|
59
|
-
"prettier": "3.
|
|
60
|
-
"tanem-scripts": "
|
|
61
|
-
"ts-jest": "29.
|
|
54
|
+
"del-cli": "7.0.0",
|
|
55
|
+
"eslint": "9.39.2",
|
|
56
|
+
"eslint-config-prettier": "10.1.8",
|
|
57
|
+
"fs-extra": "11.3.3",
|
|
58
|
+
"jest": "30.2.0",
|
|
59
|
+
"jest-snapshot": "30.2.0",
|
|
60
|
+
"npm-run-all2": "8.0.4",
|
|
61
|
+
"prettier": "3.8.1",
|
|
62
|
+
"tanem-scripts": "8.0.0",
|
|
63
|
+
"ts-jest": "29.4.6",
|
|
62
64
|
"ts-node": "10.9.2",
|
|
63
|
-
"typescript": "5.
|
|
65
|
+
"typescript": "5.9.3"
|
|
64
66
|
}
|
|
65
67
|
}
|