New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

enzyme-adapter-react-16-with-shallow-effects

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enzyme-adapter-react-16-with-shallow-effects

Shallow enzyme rendering with effect support

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
262
decreased by-12.08%
Maintainers
1
Weekly downloads
 
Created
Source

enzyme-adapter-react-16-with-shallow-effects

This extremely-long-named package is a "fork" of the react-16 adapter included with enzyme, with one difference that applies only to shallow() testing:

Also, under the hood, it uses react-shallow-renderer rather than react-test-renderer/shallow. Ongoing development of react-test-renderer/shallow has been moved to react-shallow-renderer. This should not result in any observable differences in behavior.

Example Usage:

import React from 'react';
import { shallow, configure } from 'enzyme';
import AdapterWithShallowEffects from 'enzyme-adapter-react-16-with-shallow-effects';

// setup enzyme to use the adapter
configure({ adapter: new AdapterWithShallowEffects() });

const ExampleComponent = () => {
  useEffect(() => {
    console.log('effect triggered!);

    return () => { console.log('effect cleaned up!); };
  });
  return <div />
};

console.log('rendering shallow');
const rendered = shallow(<ExampleComponent />)
console.log('unmounting');
shallow.unmount();
console.log('done');

Keywords

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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