Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-react-hooks-shallow

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-react-hooks-shallow - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

samples-and-e2e-tests/with-mocking-by-default-reset-mocks-true/babel.config.js

18

lib/enable-hooks.js

@@ -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

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