@testing-library/react-hooks
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -120,8 +120,18 @@ "use strict"; | ||
update = _testRenderer.update; | ||
var waitingForNextUpdate = null; | ||
var resolveOnNextUpdate = function resolveOnNextUpdate(resolve) { | ||
addResolver(function () { | ||
waitingForNextUpdate = null; | ||
resolve.apply(void 0, arguments); | ||
}); | ||
}; | ||
return { | ||
result: result, | ||
waitForNextUpdate: function waitForNextUpdate() { | ||
return new Promise(function (resolve) { | ||
return addResolver(resolve); | ||
waitingForNextUpdate = waitingForNextUpdate || (0, _reactTestRenderer.act)(function () { | ||
return new Promise(resolveOnNextUpdate); | ||
}); | ||
return waitingForNextUpdate; | ||
}, | ||
@@ -128,0 +138,0 @@ rerender: function rerender(newProps) { |
{ | ||
"name": "@testing-library/react-hooks", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Simple and complete React hooks testing utilities that encourage good testing practices.", | ||
@@ -39,37 +39,37 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.4.2", | ||
"@types/react": "^16.8.22", | ||
"@types/react-test-renderer": "^16.8.2" | ||
"@babel/runtime": "^7.5.4", | ||
"@types/react": ">=16.9.0", | ||
"@types/react-test-renderer": ">=16.9.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.4.4", | ||
"@babel/core": "7.4.5", | ||
"@babel/plugin-proposal-object-rest-spread": "7.4.4", | ||
"@babel/plugin-transform-modules-commonjs": "7.4.4", | ||
"@babel/plugin-transform-runtime": "7.4.4", | ||
"@babel/preset-env": "7.4.5", | ||
"@babel/cli": "7.5.5", | ||
"@babel/core": "7.5.5", | ||
"@babel/plugin-proposal-object-rest-spread": "7.5.5", | ||
"@babel/plugin-transform-modules-commonjs": "7.5.0", | ||
"@babel/plugin-transform-runtime": "7.5.5", | ||
"@babel/preset-env": "7.5.5", | ||
"@babel/preset-react": "7.0.0", | ||
"all-contributors-cli": "6.7.0", | ||
"all-contributors-cli": "6.8.1", | ||
"babel-eslint": "10.0.2", | ||
"babel-plugin-module-resolver": "3.2.0", | ||
"codecov": "3.5.0", | ||
"docz": "^1.0.4", | ||
"docz-theme-default": "^1.0.4", | ||
"eslint": "6.0.0", | ||
"eslint-config-prettier": "5.0.0", | ||
"docz": "1.2.0", | ||
"docz-theme-default": "1.2.0", | ||
"eslint": "6.1.0", | ||
"eslint-config-prettier": "6.0.0", | ||
"eslint-plugin-prettier": "3.1.0", | ||
"husky": "2.4.1", | ||
"husky": "3.0.3", | ||
"jest": "24.8.0", | ||
"lint-staged": "8.2.1", | ||
"lint-staged": "9.2.1", | ||
"prettier": "1.18.2", | ||
"prettier-eslint": "9.0.0", | ||
"prettier-eslint-cli": "5.0.0", | ||
"react": "16.8.6", | ||
"react-test-renderer": "16.8.6", | ||
"typescript": "3.5.2", | ||
"react": "16.9.0", | ||
"react-test-renderer": "16.9.0", | ||
"typescript": "3.5.3", | ||
"typings-tester": "0.3.2" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.8.0", | ||
"react-test-renderer": ">=16.8.0" | ||
"react": ">=16.9.0", | ||
"react-test-renderer": ">=16.9.0" | ||
}, | ||
@@ -76,0 +76,0 @@ "jest": { |
@@ -76,5 +76,16 @@ import React, { Suspense } from 'react' | ||
let waitingForNextUpdate = null | ||
const resolveOnNextUpdate = (resolve) => { | ||
addResolver((...args) => { | ||
waitingForNextUpdate = null | ||
resolve(...args) | ||
}) | ||
} | ||
return { | ||
result, | ||
waitForNextUpdate: () => new Promise((resolve) => addResolver(resolve)), | ||
waitForNextUpdate: () => { | ||
waitingForNextUpdate = waitingForNextUpdate || act(() => new Promise(resolveOnNextUpdate)) | ||
return waitingForNextUpdate | ||
}, | ||
rerender: (newProps = hookProps.current) => { | ||
@@ -81,0 +92,0 @@ hookProps.current = newProps |
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
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
22518
240
+ Added@types/react@18.3.12(transitive)
+ Added@types/react-test-renderer@18.3.0(transitive)
- Removed@types/react@16.14.62(transitive)
- Removed@types/react-test-renderer@16.9.12(transitive)
- Removed@types/scheduler@0.16.8(transitive)
Updated@babel/runtime@^7.5.4
Updated@types/react@>=16.9.0