jest-react-hooks-shallow
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -12,10 +12,12 @@ "use strict"; | ||
originalUseLayoutEffect = react.useLayoutEffect; | ||
if (dontMockByDefault) { | ||
useEffectMock.mockImplementation(originalUseEffect); | ||
useLayoutEffectMock.mockImplementation(originalUseLayoutEffect); | ||
} | ||
else { | ||
useEffectMock.mockImplementation(mock_use_effect_1.default()); | ||
useLayoutEffectMock.mockImplementation(mock_use_effect_1.default()); | ||
} | ||
beforeEach(() => { | ||
if (dontMockByDefault) { | ||
useEffectMock.mockImplementation(originalUseEffect); | ||
useLayoutEffectMock.mockImplementation(originalUseLayoutEffect); | ||
} | ||
else { | ||
useEffectMock.mockImplementation(mock_use_effect_1.default()); | ||
useLayoutEffectMock.mockImplementation(mock_use_effect_1.default()); | ||
} | ||
}); | ||
jestInstance.mock('react', () => (Object.assign(Object.assign({}, react), { useEffect: useEffectMock, useLayoutEffect: useLayoutEffectMock }))); | ||
@@ -22,0 +24,0 @@ }; |
{ | ||
"name": "jest-react-hooks-shallow", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "React Hooks for shallow rendering", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/mikeborozdin/jest-react-hooks-shallow", |
@@ -128,3 +128,2 @@ jest-react-hooks-shallow | ||
**setupJest.js** | ||
```js | ||
```js | ||
@@ -148,4 +147,6 @@ import enableHooks from 'jest-react-hooks-shallow'; | ||
}); | ||
``` | ||
Option 21 - `withoutHook()` | ||
Option #2 - `withoutHook()` | ||
---- | ||
@@ -152,0 +153,0 @@ Or you can enable hooks in shallow by default and surround tests using `mount()` with `withoutHooks()`, e.g.: |
@@ -61,2 +61,3 @@ import React from 'react'; | ||
jest.clearAllMocks(); | ||
jest.resetAllMocks(); | ||
}); | ||
@@ -63,0 +64,0 @@ |
@@ -29,9 +29,11 @@ import mockUseEffect from "./mock-use-effect/mock-use-effect"; | ||
if (dontMockByDefault) { | ||
useEffectMock.mockImplementation(originalUseEffect); | ||
useLayoutEffectMock.mockImplementation(originalUseLayoutEffect); | ||
} else { | ||
beforeEach(() => { | ||
if (dontMockByDefault) { | ||
useEffectMock.mockImplementation(originalUseEffect); | ||
useLayoutEffectMock.mockImplementation(originalUseLayoutEffect); | ||
} else { | ||
useEffectMock.mockImplementation(mockUseEffect()); | ||
useLayoutEffectMock.mockImplementation(mockUseEffect()); | ||
} | ||
} | ||
}); | ||
@@ -38,0 +40,0 @@ jestInstance.mock('react', () => ({ |
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
1939848
62
48623
230
2