Skip to content

Commit

Permalink
patch dom testing library for new pretty format api
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Sep 15, 2020
1 parent 71cb36e commit 0e91708
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,8 @@
},
"engines": {
"node": ">= 10.14.2"
},
"resolutions": {
"@testing-library/dom": "patch:@testing-library/dom@*#./patches/dom-testing.diff"
}
}
38 changes: 38 additions & 0 deletions patches/dom-testing.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/dist/pretty-dom.js b/dist/pretty-dom.js
index 6719cb06f4a1adba30333866a9a84bce794446a9..50d91905461fa44f7fdf5d403c10df4161dcfeae 100644
--- a/dist/pretty-dom.js
+++ b/dist/pretty-dom.js
@@ -1,14 +1,12 @@
"use strict";

-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.prettyDOM = prettyDOM;
exports.logDOM = void 0;

-var _prettyFormat = _interopRequireDefault(require("pretty-format"));
+var _prettyFormat = require("pretty-format");

var _getUserCodeFrame = require("./get-user-code-frame");

@@ -26,7 +24,7 @@ const getMaxLength = dom => inCypress(dom) ? 0 : typeof process !== 'undefined'
const {
DOMElement,
DOMCollection
-} = _prettyFormat.default.plugins;
+} = _prettyFormat.plugins;

function prettyDOM(dom, maxLength, options) {
if (!dom) {
@@ -58,7 +56,7 @@ function prettyDOM(dom, maxLength, options) {
throw new TypeError(`Expected an element or document but got ${domTypeName}`);
}

- const debugContent = (0, _prettyFormat.default)(dom, {
+ const debugContent = (0, _prettyFormat.format)(dom, {
plugins: [DOMElement, DOMCollection],
printFunctionName: false,
highlight: inNode(),
1 change: 1 addition & 0 deletions scripts/checkCopyrightHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const createRegExp = pattern => new RegExp(pattern);
const GENERIC_IGNORED_EXTENSIONS = [
'lock',
'patch',
'diff',
'exe',
'bin',
'cfg',
Expand Down
17 changes: 16 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3195,7 +3195,7 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/dom@npm:^7.24.2":
"@testing-library/dom@*":
version: 7.24.2
resolution: "@testing-library/dom@npm:7.24.2"
dependencies:
Expand All @@ -3210,6 +3210,21 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/dom@patch:@testing-library/dom@*#./patches/dom-testing.diff::locator=root-workspace-0b6124%40workspace%3A.":
version: 7.24.2
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."
dependencies:
"@babel/code-frame": ^7.10.4
"@babel/runtime": ^7.10.3
"@types/aria-query": ^4.2.0
aria-query: ^4.2.2
chalk: ^4.1.0
dom-accessibility-api: ^0.5.1
pretty-format: ^26.4.2
checksum: 40f2566efca491df61921053d11c56aee827f651a944d95cfa270647e685b9be182e9e44f5e6dcbef3dacd0fb077bc7be9dad4ad4eabe8d26c53a20dbd0a391d
languageName: node
linkType: hard

"@testing-library/react@npm:*":
version: 11.0.4
resolution: "@testing-library/react@npm:11.0.4"
Expand Down

0 comments on commit 0e91708

Please sign in to comment.