@testing-library/react
Advanced tools
Comparing version 9.5.0 to 10.0.0-beta.1
@@ -15,48 +15,2 @@ 'use strict'; | ||
/* istanbul ignore file */ | ||
// the part of this file that we need tested is definitely being run | ||
// and the part that is not cannot easily have useful tests written | ||
// anyway. So we're just going to ignore coverage for this file | ||
/** | ||
* copied from React's enqueueTask.js | ||
*/ | ||
var didWarnAboutMessageChannel = false; | ||
var enqueueTask; | ||
try { | ||
// read require off the module object to get around the bundlers. | ||
// we don't want them to detect a require and bundle a Node polyfill. | ||
var requireString = ("require" + Math.random()).slice(0, 7); | ||
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's | ||
// version of setImmediate, bypassing fake timers if any. | ||
enqueueTask = nodeRequire('timers').setImmediate; | ||
} catch (_err) { | ||
// we're in a browser | ||
// we can't use regular timers because they may still be faked | ||
// so we try MessageChannel+postMessage instead | ||
enqueueTask = function (callback) { | ||
var supportsMessageChannel = typeof MessageChannel === 'function'; | ||
if (supportsMessageChannel) { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = callback; | ||
channel.port2.postMessage(undefined); | ||
} else if (didWarnAboutMessageChannel === false) { | ||
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console | ||
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); | ||
} | ||
}; | ||
} | ||
function flushMicroTasks() { | ||
return { | ||
then: function then(resolve) { | ||
enqueueTask(resolve); | ||
} | ||
}; | ||
} | ||
var reactAct = testUtils.act; | ||
@@ -182,2 +136,48 @@ var actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0 | ||
/* istanbul ignore file */ | ||
// the part of this file that we need tested is definitely being run | ||
// and the part that is not cannot easily have useful tests written | ||
// anyway. So we're just going to ignore coverage for this file | ||
/** | ||
* copied from React's enqueueTask.js | ||
*/ | ||
var didWarnAboutMessageChannel = false; | ||
var enqueueTask; | ||
try { | ||
// read require off the module object to get around the bundlers. | ||
// we don't want them to detect a require and bundle a Node polyfill. | ||
var requireString = ("require" + Math.random()).slice(0, 7); | ||
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's | ||
// version of setImmediate, bypassing fake timers if any. | ||
enqueueTask = nodeRequire('timers').setImmediate; | ||
} catch (_err) { | ||
// we're in a browser | ||
// we can't use regular timers because they may still be faked | ||
// so we try MessageChannel+postMessage instead | ||
enqueueTask = function (callback) { | ||
var supportsMessageChannel = typeof MessageChannel === 'function'; | ||
if (supportsMessageChannel) { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = callback; | ||
channel.port2.postMessage(undefined); | ||
} else if (didWarnAboutMessageChannel === false) { | ||
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console | ||
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); | ||
} | ||
}; | ||
} | ||
function flushMicroTasks() { | ||
return { | ||
then: function then(resolve) { | ||
enqueueTask(resolve); | ||
} | ||
}; | ||
} | ||
dom.configure({ | ||
@@ -303,3 +303,3 @@ asyncWrapper: function () { | ||
function cleanup() { | ||
mountedContainers.forEach(cleanupAtContainer); | ||
return _cleanup.apply(this, arguments); | ||
} // maybe one day we'll expose this (perhaps even as a utility returned by render). | ||
@@ -309,2 +309,24 @@ // but let's wait until someone asks for it. | ||
function _cleanup() { | ||
_cleanup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { | ||
return _regeneratorRuntime.wrap(function (_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.next = 2; | ||
return flushMicroTasks(); | ||
case 2: | ||
mountedContainers.forEach(cleanupAtContainer); | ||
case 3: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
})); | ||
return _cleanup.apply(this, arguments); | ||
} | ||
function cleanupAtContainer(container) { | ||
@@ -399,8 +421,5 @@ ReactDOM.unmountComponentAtNode(container); | ||
_context.next = 2; | ||
return flushMicroTasks(); | ||
return cleanup(); | ||
case 2: | ||
cleanup(); | ||
case 3: | ||
case "end": | ||
@@ -407,0 +426,0 @@ return _context.stop(); |
@@ -10,48 +10,2 @@ import _regeneratorRuntime from '@babel/runtime/regenerator'; | ||
/* istanbul ignore file */ | ||
// the part of this file that we need tested is definitely being run | ||
// and the part that is not cannot easily have useful tests written | ||
// anyway. So we're just going to ignore coverage for this file | ||
/** | ||
* copied from React's enqueueTask.js | ||
*/ | ||
var didWarnAboutMessageChannel = false; | ||
var enqueueTask; | ||
try { | ||
// read require off the module object to get around the bundlers. | ||
// we don't want them to detect a require and bundle a Node polyfill. | ||
var requireString = ("require" + Math.random()).slice(0, 7); | ||
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's | ||
// version of setImmediate, bypassing fake timers if any. | ||
enqueueTask = nodeRequire('timers').setImmediate; | ||
} catch (_err) { | ||
// we're in a browser | ||
// we can't use regular timers because they may still be faked | ||
// so we try MessageChannel+postMessage instead | ||
enqueueTask = function (callback) { | ||
var supportsMessageChannel = typeof MessageChannel === 'function'; | ||
if (supportsMessageChannel) { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = callback; | ||
channel.port2.postMessage(undefined); | ||
} else if (didWarnAboutMessageChannel === false) { | ||
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console | ||
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); | ||
} | ||
}; | ||
} | ||
function flushMicroTasks() { | ||
return { | ||
then: function then(resolve) { | ||
enqueueTask(resolve); | ||
} | ||
}; | ||
} | ||
var reactAct = act$1; | ||
@@ -177,2 +131,48 @@ var actSupported = reactAct !== undefined; // act is supported react-dom@16.8.0 | ||
/* istanbul ignore file */ | ||
// the part of this file that we need tested is definitely being run | ||
// and the part that is not cannot easily have useful tests written | ||
// anyway. So we're just going to ignore coverage for this file | ||
/** | ||
* copied from React's enqueueTask.js | ||
*/ | ||
var didWarnAboutMessageChannel = false; | ||
var enqueueTask; | ||
try { | ||
// read require off the module object to get around the bundlers. | ||
// we don't want them to detect a require and bundle a Node polyfill. | ||
var requireString = ("require" + Math.random()).slice(0, 7); | ||
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's | ||
// version of setImmediate, bypassing fake timers if any. | ||
enqueueTask = nodeRequire('timers').setImmediate; | ||
} catch (_err) { | ||
// we're in a browser | ||
// we can't use regular timers because they may still be faked | ||
// so we try MessageChannel+postMessage instead | ||
enqueueTask = function (callback) { | ||
var supportsMessageChannel = typeof MessageChannel === 'function'; | ||
if (supportsMessageChannel) { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = callback; | ||
channel.port2.postMessage(undefined); | ||
} else if (didWarnAboutMessageChannel === false) { | ||
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console | ||
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); | ||
} | ||
}; | ||
} | ||
function flushMicroTasks() { | ||
return { | ||
then: function then(resolve) { | ||
enqueueTask(resolve); | ||
} | ||
}; | ||
} | ||
configure({ | ||
@@ -298,3 +298,3 @@ asyncWrapper: function () { | ||
function cleanup() { | ||
mountedContainers.forEach(cleanupAtContainer); | ||
return _cleanup.apply(this, arguments); | ||
} // maybe one day we'll expose this (perhaps even as a utility returned by render). | ||
@@ -304,2 +304,24 @@ // but let's wait until someone asks for it. | ||
function _cleanup() { | ||
_cleanup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { | ||
return _regeneratorRuntime.wrap(function (_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.next = 2; | ||
return flushMicroTasks(); | ||
case 2: | ||
mountedContainers.forEach(cleanupAtContainer); | ||
case 3: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
})); | ||
return _cleanup.apply(this, arguments); | ||
} | ||
function cleanupAtContainer(container) { | ||
@@ -394,8 +416,5 @@ ReactDOM.unmountComponentAtNode(container); | ||
_context.next = 2; | ||
return flushMicroTasks(); | ||
return cleanup(); | ||
case 2: | ||
cleanup(); | ||
case 3: | ||
case "end": | ||
@@ -402,0 +421,0 @@ return _context.stop(); |
@@ -135,2 +135,48 @@ 'use strict'; | ||
/* istanbul ignore file */ | ||
// the part of this file that we need tested is definitely being run | ||
// and the part that is not cannot easily have useful tests written | ||
// anyway. So we're just going to ignore coverage for this file | ||
/** | ||
* copied from React's enqueueTask.js | ||
*/ | ||
var didWarnAboutMessageChannel = false; | ||
var enqueueTask; | ||
try { | ||
// read require off the module object to get around the bundlers. | ||
// we don't want them to detect a require and bundle a Node polyfill. | ||
var requireString = ("require" + Math.random()).slice(0, 7); | ||
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's | ||
// version of setImmediate, bypassing fake timers if any. | ||
enqueueTask = nodeRequire('timers').setImmediate; | ||
} catch (_err) { | ||
// we're in a browser | ||
// we can't use regular timers because they may still be faked | ||
// so we try MessageChannel+postMessage instead | ||
enqueueTask = function (callback) { | ||
var supportsMessageChannel = typeof MessageChannel === 'function'; | ||
if (supportsMessageChannel) { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = callback; | ||
channel.port2.postMessage(undefined); | ||
} else if (didWarnAboutMessageChannel === false) { | ||
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console | ||
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); | ||
} | ||
}; | ||
} | ||
function flushMicroTasks() { | ||
return { | ||
then: function then(resolve) { | ||
enqueueTask(resolve); | ||
} | ||
}; | ||
} | ||
dom.configure({ | ||
@@ -256,3 +302,3 @@ asyncWrapper: function () { | ||
function cleanup() { | ||
mountedContainers.forEach(cleanupAtContainer); | ||
return _cleanup.apply(this, arguments); | ||
} // maybe one day we'll expose this (perhaps even as a utility returned by render). | ||
@@ -262,2 +308,24 @@ // but let's wait until someone asks for it. | ||
function _cleanup() { | ||
_cleanup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { | ||
return _regeneratorRuntime.wrap(function (_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.next = 2; | ||
return flushMicroTasks(); | ||
case 2: | ||
mountedContainers.forEach(cleanupAtContainer); | ||
case 3: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
})); | ||
return _cleanup.apply(this, arguments); | ||
} | ||
function cleanupAtContainer(container) { | ||
@@ -264,0 +332,0 @@ ReactDOM.unmountComponentAtNode(container); |
@@ -130,2 +130,48 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
/* istanbul ignore file */ | ||
// the part of this file that we need tested is definitely being run | ||
// and the part that is not cannot easily have useful tests written | ||
// anyway. So we're just going to ignore coverage for this file | ||
/** | ||
* copied from React's enqueueTask.js | ||
*/ | ||
var didWarnAboutMessageChannel = false; | ||
var enqueueTask; | ||
try { | ||
// read require off the module object to get around the bundlers. | ||
// we don't want them to detect a require and bundle a Node polyfill. | ||
var requireString = ("require" + Math.random()).slice(0, 7); | ||
var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's | ||
// version of setImmediate, bypassing fake timers if any. | ||
enqueueTask = nodeRequire('timers').setImmediate; | ||
} catch (_err) { | ||
// we're in a browser | ||
// we can't use regular timers because they may still be faked | ||
// so we try MessageChannel+postMessage instead | ||
enqueueTask = function (callback) { | ||
var supportsMessageChannel = typeof MessageChannel === 'function'; | ||
if (supportsMessageChannel) { | ||
var channel = new MessageChannel(); | ||
channel.port1.onmessage = callback; | ||
channel.port2.postMessage(undefined); | ||
} else if (didWarnAboutMessageChannel === false) { | ||
didWarnAboutMessageChannel = true; // eslint-disable-next-line no-console | ||
console.error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); | ||
} | ||
}; | ||
} | ||
function flushMicroTasks() { | ||
return { | ||
then: function then(resolve) { | ||
enqueueTask(resolve); | ||
} | ||
}; | ||
} | ||
configure({ | ||
@@ -251,3 +297,3 @@ asyncWrapper: function () { | ||
function cleanup() { | ||
mountedContainers.forEach(cleanupAtContainer); | ||
return _cleanup.apply(this, arguments); | ||
} // maybe one day we'll expose this (perhaps even as a utility returned by render). | ||
@@ -257,2 +303,24 @@ // but let's wait until someone asks for it. | ||
function _cleanup() { | ||
_cleanup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { | ||
return _regeneratorRuntime.wrap(function (_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context3.next = 2; | ||
return flushMicroTasks(); | ||
case 2: | ||
mountedContainers.forEach(cleanupAtContainer); | ||
case 3: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
})); | ||
return _cleanup.apply(this, arguments); | ||
} | ||
function cleanupAtContainer(container) { | ||
@@ -259,0 +327,0 @@ ReactDOM.unmountComponentAtNode(container); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,4 +7,2 @@ value: true | ||
var _flushMicrotasks = _interopRequireDefault(require("./flush-microtasks")); | ||
var _pure = require("./pure"); | ||
@@ -31,5 +27,4 @@ | ||
afterEach(async () => { | ||
await (0, _flushMicrotasks.default)(); | ||
(0, _pure.cleanup)(); | ||
await (0, _pure.cleanup)(); | ||
}); | ||
} |
@@ -26,4 +26,2 @@ "use strict"; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _react = _interopRequireDefault(require("react")); | ||
@@ -48,2 +46,4 @@ | ||
var _flushMicrotasks = _interopRequireDefault(require("./flush-microtasks")); | ||
(0, _dom.configure)({ | ||
@@ -91,3 +91,3 @@ asyncWrapper: async cb => { | ||
}); | ||
return (0, _extends2.default)({ | ||
return { | ||
container, | ||
@@ -115,7 +115,9 @@ baseElement, | ||
return template.content; | ||
} | ||
}, (0, _dom.getQueriesForElement)(baseElement, queries)); | ||
}, | ||
...(0, _dom.getQueriesForElement)(baseElement, queries) | ||
}; | ||
} | ||
function cleanup() { | ||
async function cleanup() { | ||
await (0, _flushMicrotasks.default)(); | ||
mountedContainers.forEach(cleanupAtContainer); | ||
@@ -122,0 +124,0 @@ } // maybe one day we'll expose this (perhaps even as a utility returned by render). |
{ | ||
"name": "@testing-library/react", | ||
"version": "9.5.0", | ||
"version": "10.0.0-beta.1", | ||
"description": "Simple and complete React DOM testing utilities that encourage good testing practices.", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=10" | ||
}, | ||
@@ -50,3 +50,3 @@ "scripts": { | ||
"@babel/runtime": "^7.8.4", | ||
"@testing-library/dom": "^6.15.0", | ||
"@testing-library/dom": "beta", | ||
"@types/testing-library__react": "^9.1.2" | ||
@@ -53,0 +53,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4341812
27603
3
+ Added@testing-library/dom@7.0.0-beta.4(transitive)
- Removed@sheerun/mutationobserver-shim@0.3.3(transitive)
- Removed@testing-library/dom@6.16.0(transitive)
- Removedwait-for-expect@3.0.2(transitive)
Updated@testing-library/dom@beta