Socket
Socket
Sign inDemoInstall

jest-dev-server

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-dev-server

Starts a server before your Jest tests and tears it down after.


Version published
Weekly downloads
127K
decreased by-42.29%
Maintainers
2
Weekly downloads
 
Created

What is jest-dev-server?

The jest-dev-server package is a utility for running a development server while running Jest tests. It is particularly useful for end-to-end (E2E) testing where you need a server to be up and running before executing your tests.

What are jest-dev-server's main functionalities?

Starting a development server

This feature allows you to start a development server before running your tests. The `setupDevServer` function takes an object with a `command` to start the server and a `port` to listen on.

const { setup: setupDevServer } = require('jest-dev-server');

beforeAll(async () => {
  await setupDevServer({
    command: 'npm run start',
    port: 3000,
  });
});

Stopping the development server

This feature allows you to stop the development server after your tests have completed. The `teardownDevServer` function ensures that the server is properly shut down.

const { teardown: teardownDevServer } = require('jest-dev-server');

afterAll(async () => {
  await teardownDevServer();
});

Custom server options

This feature allows you to customize the server options such as `launchTimeout` and `debug` mode. This is useful for fine-tuning the server startup process to match your specific needs.

const { setup: setupDevServer } = require('jest-dev-server');

beforeAll(async () => {
  await setupDevServer({
    command: 'npm run start',
    port: 3000,
    launchTimeout: 50000,
    debug: true,
  });
});

Other packages similar to jest-dev-server

Keywords

FAQs

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc