Socket
Socket
Sign inDemoInstall

@testing-library/dom

Package Overview
Dependencies
Maintainers
16
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/dom - npm Package Compare versions

Comparing version 7.29.4 to 7.29.5

49

dist/helpers.js

@@ -19,5 +19,16 @@ "use strict";

function runWithRealTimers(callback) {
const fakeTimersType = getJestFakeTimersType();
return _runWithRealTimers(callback).callbackReturnValue;
}
if (fakeTimersType) {
function _runWithRealTimers(callback) {
const timerAPI = {
clearImmediate,
clearInterval,
clearTimeout,
setImmediate,
setInterval,
setTimeout
}; // istanbul ignore else
if (typeof jest !== 'undefined') {
jest.useRealTimers();

@@ -27,33 +38,17 @@ }

const callbackReturnValue = callback();
const usedJestFakeTimers = Object.entries(timerAPI).some(([name, func]) => func !== globalObj[name]);
if (fakeTimersType) {
jest.useFakeTimers(fakeTimersType);
}
if (usedJestFakeTimers) {
var _timerAPI$setTimeout;
return callbackReturnValue;
}
function getJestFakeTimersType() {
// istanbul ignore if
if (typeof jest === 'undefined' || typeof globalObj.setTimeout === 'undefined') {
return null;
jest.useFakeTimers((_timerAPI$setTimeout = timerAPI.setTimeout) != null && _timerAPI$setTimeout.clock ? 'modern' : 'legacy');
}
if (typeof globalObj.setTimeout._isMockFunction !== 'undefined' && globalObj.setTimeout._isMockFunction) {
return 'legacy';
}
if (typeof globalObj.setTimeout.clock !== 'undefined' && typeof jest.getRealSystemTime !== 'undefined') {
try {
// jest.getRealSystemTime is only supported for Jest's `modern` fake timers and otherwise throws
jest.getRealSystemTime();
return 'modern';
} catch {// not using Jest's modern fake timers
}
}
return null;
return {
callbackReturnValue,
usedJestFakeTimers
};
}
const jestFakeTimersAreEnabled = () => Boolean(getJestFakeTimersType()); // we only run our tests in node, and setImmediate is supported in node.
const jestFakeTimersAreEnabled = () => Boolean(_runWithRealTimers(() => {}).usedJestFakeTimers); // we only run our tests in node, and setImmediate is supported in node.
// istanbul ignore next

@@ -60,0 +55,0 @@

{
"name": "@testing-library/dom",
"version": "7.29.4",
"version": "7.29.5",
"description": "Simple and complete DOM testing utilities that encourage good testing practices.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -307,2 +307,3 @@ <div align="center">

<td align="center"><a href="https://github.com/nathanforce"><img src="https://avatars2.githubusercontent.com/u/6694194?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nathan Force</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/commits?author=nathanforce" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ph-fritsche"><img src="https://avatars.githubusercontent.com/u/39068198?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Philipp Fritsche</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/commits?author=ph-fritsche" title="Code">💻</a></td>
</tr>

@@ -354,4 +355,4 @@ </table>

[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square
[discord]: https://discord.gg/c6JN9fM
[discord]: https://discord.gg/testing-library
<!-- prettier-ignore-end -->

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc