Skip to content

Commit 0e91708

Browse files
committed
patch dom testing library for new pretty format api
1 parent 71cb36e commit 0e91708

4 files changed

Lines changed: 58 additions & 1 deletion

File tree

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,8 @@
132132
},
133133
"engines": {
134134
"node": ">= 10.14.2"
135+
},
136+
"resolutions": {
137+
"@testing-library/dom": "patch:@testing-library/dom@*#./patches/dom-testing.diff"
135138
}
136139
}

patches/dom-testing.diff

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
diff --git a/dist/pretty-dom.js b/dist/pretty-dom.js
2+
index 6719cb06f4a1adba30333866a9a84bce794446a9..50d91905461fa44f7fdf5d403c10df4161dcfeae 100644
3+
--- a/dist/pretty-dom.js
4+
+++ b/dist/pretty-dom.js
5+
@@ -1,14 +1,12 @@
6+
"use strict";
7+
8+
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
9+
-
10+
Object.defineProperty(exports, "__esModule", {
11+
value: true
12+
});
13+
exports.prettyDOM = prettyDOM;
14+
exports.logDOM = void 0;
15+
16+
-var _prettyFormat = _interopRequireDefault(require("pretty-format"));
17+
+var _prettyFormat = require("pretty-format");
18+
19+
var _getUserCodeFrame = require("./get-user-code-frame");
20+
21+
@@ -26,7 +24,7 @@ const getMaxLength = dom => inCypress(dom) ? 0 : typeof process !== 'undefined'
22+
const {
23+
DOMElement,
24+
DOMCollection
25+
-} = _prettyFormat.default.plugins;
26+
+} = _prettyFormat.plugins;
27+
28+
function prettyDOM(dom, maxLength, options) {
29+
if (!dom) {
30+
@@ -58,7 +56,7 @@ function prettyDOM(dom, maxLength, options) {
31+
throw new TypeError(`Expected an element or document but got ${domTypeName}`);
32+
}
33+
34+
- const debugContent = (0, _prettyFormat.default)(dom, {
35+
+ const debugContent = (0, _prettyFormat.format)(dom, {
36+
plugins: [DOMElement, DOMCollection],
37+
printFunctionName: false,
38+
highlight: inNode(),

scripts/checkCopyrightHeaders.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const createRegExp = pattern => new RegExp(pattern);
2020
const GENERIC_IGNORED_EXTENSIONS = [
2121
'lock',
2222
'patch',
23+
'diff',
2324
'exe',
2425
'bin',
2526
'cfg',

yarn.lock

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3195,7 +3195,7 @@ __metadata:
31953195
languageName: node
31963196
linkType: hard
31973197

3198-
"@testing-library/dom@npm:^7.24.2":
3198+
"@testing-library/dom@*":
31993199
version: 7.24.2
32003200
resolution: "@testing-library/dom@npm:7.24.2"
32013201
dependencies:
@@ -3210,6 +3210,21 @@ __metadata:
32103210
languageName: node
32113211
linkType: hard
32123212

3213+
"@testing-library/dom@patch:@testing-library/dom@*#./patches/dom-testing.diff::locator=root-workspace-0b6124%40workspace%3A.":
3214+
version: 7.24.2
3215+
resolution: "@testing-library/dom@patch:@testing-library/dom@npm%3A7.24.2#./patches/dom-testing.diff::version=7.24.2&hash=332747&locator=root-workspace-0b6124%40workspace%3A."
3216+
dependencies:
3217+
"@babel/code-frame": ^7.10.4
3218+
"@babel/runtime": ^7.10.3
3219+
"@types/aria-query": ^4.2.0
3220+
aria-query: ^4.2.2
3221+
chalk: ^4.1.0
3222+
dom-accessibility-api: ^0.5.1
3223+
pretty-format: ^26.4.2
3224+
checksum: 40f2566efca491df61921053d11c56aee827f651a944d95cfa270647e685b9be182e9e44f5e6dcbef3dacd0fb077bc7be9dad4ad4eabe8d26c53a20dbd0a391d
3225+
languageName: node
3226+
linkType: hard
3227+
32133228
"@testing-library/react@npm:*":
32143229
version: 11.0.4
32153230
resolution: "@testing-library/react@npm:11.0.4"

0 commit comments

Comments
 (0)