Gathering detailed insights and metrics for jest-process-manager
Gathering detailed insights and metrics for jest-process-manager
Gathering detailed insights and metrics for jest-process-manager
Gathering detailed insights and metrics for jest-process-manager
process
process information for node.js and browsers
jest-worker
Module for executing heavy tasks under forked processes in parallel, by providing a `Promise` based interface, minimum overhead, and bound workers.
@jest/create-cache-key-function
This module creates a function which is used for generating cache keys used by code transformers in Jest.
jest-mock-process
Easily mock NodeJS process properties in Jest
Starts a server before the Jest tests and tears it down after.
npm install jest-process-manager
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
19 Stars
41 Commits
4 Forks
4 Watching
3 Branches
7 Contributors
Updated on 14 Jun 2024
Minified
Minified + Gzipped
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
-3.7%
192,525
Compared to previous day
Last week
2.1%
1,018,353
Compared to previous week
Last month
15.9%
4,248,424
Compared to previous month
Last year
139.6%
34,749,701
Compared to previous year
This project was forked because the package jest-dev-server
is no longer maintained.
Starts a server before your Jest tests and tears it down after.
jest-playwright-preset
or jest-puppeteer
works great for running tests in Jest using your preferred end-to-end testing library.
It's also useful for starting a local development server during the tests without letting Jest hang.
This package extracts just the local development server spawning without any ties to Puppeteer.
1npm install --save-dev jest-process-manager
jest-process-manager
exports setup
,teardown
and getServers
functions.
1// global-setup.js
2const { setup: setupDevServer } = require('jest-process-manager')
3
4module.exports = async function globalSetup() {
5 await setupDevServer({
6 command: `node config/start.js --port=3000`,
7 launchTimeout: 50000,
8 port: 3000,
9 })
10 // Your global setup
11}
It is also possible to specify several servers:
1// global-setup.js
2const { setup: setupDevServer } = require('jest-process-manager')
3
4module.exports = async function globalSetup() {
5 await setupDevServer([
6 {
7 command: 'node server.js',
8 port: 4444,
9 },
10 {
11 command: 'node server2.js',
12 port: 4445,
13 },
14 ])
15 // Your global setup
16}
1// global-setup.js
2const { setup: setupDevServer, getServers } = require('jest-process-manager')
3
4module.exports = async function globalSetup() {
5 await setupDevServer({
6 command: `node config/start.js --port=3000`,
7 launchTimeout: 50000,
8 port: 3000,
9 })
10 getServers.then(servers => {
11 // You can get to the servers and do whatever you want
12 })
13 // Your global setup
14}
1// global-teardown.js 2const { teardown: teardownDevServer } = require('jest-process-manager') 3 4module.exports = async function globalTeardown() { 5 await teardownDevServer() 6 // Your global teardown 7}
command
Type: string
, required.
Command to execute to start the port.
Directly passed to spawnd
.
1module.exports = { 2 command: 'npm run start', 3}
debug
Type: boolean
, default to false
.
Log server output, useful if server is crashing at start.
1module.exports = { 2 command: 'npm run start', 3 debug: true, 4}
launchTimeout
Type: number
, default to 5000
.
How many milliseconds to wait for the spawned server to be available before giving up.
Defaults to wait-port
's default.
1module.exports = { 2 command: 'npm run start', 3 launchTimeout: 30000, 4}
Following options are linked to spawnd
.
host
Type: string
, default to localhost
.
Host to wait for activity on before considering the server running.
Must be used in conjunction with port
.
1module.exports = { 2 command: 'npm run start --port 3000', 3 host: 'customhost.com', 4 port: 3000, 5}
protocol
Type: (https
, http
, http-get
, https-get
, tcp
, socket
) default to tcp
.
To wait for an HTTP or TCP endpoint before considering the server running, include http
or tcp
as a protocol.
Must be used in conjunction with port
.
This give you ability to define resource prefix for wait-on
package.
1module.exports = { 2 command: 'npm run start --port 3000', 3 protocol: 'http', 4 port: 3000, 5}
port
Type: number
, default to 3000
.
Port to wait for activity on before considering the server running. If not provided, the server is assumed to immediately be running.
1module.exports = { 2 command: 'npm run start --port 3000', 3 port: 3000, 4}
basePath
Type: string
Option for a basePath where server is running.
1module.exports = { 2 command: 'npm run start', 3 basePath: '/myservice', 4}
usedPortAction
Type: string
(ask
, error
, ignore
, kill
) default to ask
.
It defines the action to take if port is already used:
ask
: a prompt is shown to decide if you want to kill the process or noterror
: an errow is thrownignore
: your test are executed, we assume that the server is already startedkill
: the process is automatically killed without a prompt1module.exports = { 2 command: 'npm run start --port 3000', 3 port: 3000, 4 usedPortAction: 'kill', 5}
waitOnScheme
jest-dev-server
use the wait-on
npm package to wait for resources to become available before calling callback.
Type: object
, default to {}
.
delay
: optional initial delay in ms, default 0interval
: optional poll resource interval in ms, default 250mslog
: optional flag which outputs to stdout, remaining resources waited on and when complete or erroredreverse
: optional flag to reverse operation so checks are for resources being NOT available, default falsetimeout
: optional timeout in ms, default Infinity. Aborts with errortcpTimeout
: optional tcp timeout in ms, default 300msverbose
: optional flag which outputs debug output, default falsewindow
: optional stabilization time in ms, default 750ms. Waits this amount of time for file sizes to stabilize or other resource availability to remain unchangedNote: http(s) specific options, see https://github.com/request/request#readme for specific details
1module.exports = { 2 command: 'npm run start --port 3000', 3 port: 3000, 4 usedPortAction: 'kill', 5 waitOnScheme: { 6 delay: 1000, 7 }, 8}
options
Options which will be passed down to the spawn of the process. For example environment variables:
1// global-setup.js
2const { setup: setupDevServer, getServers } = require('jest-process-manager')
3
4module.exports = async function globalSetup() {
5 await setupDevServer({
6 command: `node config/start.js --port=3000`,
7 launchTimeout: 50000,
8 port: 3000,
9 options: {
10 env: {
11 "FOO": "bar",
12 }
13 }
14 })
15 getServers.then(servers => {
16 // You can get to the servers and do whatever you want
17 })
18 // Your global setup
19}
port
makes the terminal to ask for root password although the port is valid and accessible then use usePortAction: 'ignore'
.https://github.com/playwright-community/jest-process-manager/blob/master/LICENSE
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 14/29 approved changesets -- score normalized to 4
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More