Socket
Socket
Sign inDemoInstall

jest-expo

Package Overview
Dependencies
Maintainers
24
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-expo

A Jest preset to painlessly test your Expo / React Native apps.


Version published
Weekly downloads
347K
increased by7.08%
Maintainers
24
Weekly downloads
 
Created

What is jest-expo?

The jest-expo package is a set of Jest presets tailored for testing Expo applications. It simplifies the setup and configuration needed to test React Native components and other Expo-specific features, making it easier to write and run tests for Expo projects.

What are jest-expo's main functionalities?

Preset Configuration

The jest-expo package provides a preset configuration that you can use in your Jest configuration file. This preset includes all necessary settings to test Expo applications, such as transforming JavaScript and TypeScript files, handling static assets, and mocking native modules.

module.exports = { preset: 'jest-expo' };

Snapshot Testing

Snapshot testing is a feature that allows you to capture the rendered output of a component and compare it to a reference snapshot file. This helps ensure that your UI does not change unexpectedly.

import React from 'react';
import renderer from 'react-test-renderer';
import App from '../App';

test('App snapshot', () => {
  const tree = renderer.create(<App />).toJSON();
  expect(tree).toMatchSnapshot();
});

Mocking Native Modules

jest-expo makes it easy to mock native modules and Expo-specific APIs, allowing you to test components that rely on these modules without needing a physical device or emulator.

jest.mock('expo-constants', () => ({
  manifest: {
    extra: {
      apiUrl: 'https://api.example.com'
    }
  }
}));

Other packages similar to jest-expo

FAQs

Package last updated on 16 Dec 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