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

@reportportal/agent-js-jest

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reportportal/agent-js-jest

A Jest reporter that uploads test results to ReportPortal

  • 5.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
decreased by-2.07%
Maintainers
4
Weekly downloads
 
Created
Source

@reportportal/agent-js-jest

Agent to integrate Jest with ReportPortal.

  • More about Jest
  • More about ReportPortal

Installation

npm install --save-dev @reportportal/agent-js-jest

Configuration

1. Create jest.config.js file with reportportal configuration:

module.exports = {
    testRunner: 'jest-circus/runner',
    testRegex: ['/__tests__/.*.spec.js?$'],
    reporters: [
        'default',
        [
            '@reportportal/agent-js-jest',
            {
                apiKey: 'reportportalApiKey',
                endpoint: 'https://your.reportportal.server/api/v1',
                project: 'Your reportportal project name',
                launch: 'Your launch name',
                attributes: [
                    {
                        key: 'key',
                        value: 'value',
                    },
                    {
                        value: 'value',
                    },
                ],
                description: 'Your launch description',
            }
        ]
    ],
    ...
};

In case you use the jest config section of package.json, add the following entry:

{
    "jest": {
        ...
        "reporters": [
            "default",
            ["@reportportal/agent-js-jest",
            {
                "token": "reportportalApiKey",
                "endpoint": "https://your.reportportal.server/api/v1",
                "project": "Your reportportal project name",
                "launch": "Your launch name",
                "attributes": [
                    {
                        "key": "key",
                        "value": "value"
                    },
                    {
                        "value": "value"
                    }
                ],
                "description": "Your launch description"
            }]
        ],
        ...
    }
}

The full list of available options presented below.

OptionNecessityDefaultDescription
apiKeyRequiredUser's reportportal token from which you want to send requests. It can be found on the profile page of this user.
endpointRequiredURL of your server. For example 'https://server:8080/api/v1'.
launchRequiredName of launch at creation.
projectRequiredThe name of the project in which the launches will be created.
attributesOptional[]Launch attributes.
descriptionOptional''Launch description.
rerunOptionalfalseEnable rerun
rerunOfOptionalNot setUUID of launch you want to rerun. If not specified, reportportal will update the latest launch with the same name
modeOptional'DEFAULT'Results will be submitted to Launches page
'DEBUG' - Results will be submitted to Debug page.
skippedIssueOptionaltruereportportal provides feature to mark skipped tests as not 'To Investigate'.
Option could be equal boolean values:
true - skipped tests considered as issues and will be marked as 'To Investigate' on reportportal.
false - skipped tests will not be marked as 'To Investigate' on application.
debugOptionalfalseThis flag allows seeing the logs of the client-javascript. Useful for debugging.
launchIdOptionalNot setThe ID of an already existing launch. The launch must be in 'IN_PROGRESS' status while the tests are running. Please note that if this ID is provided, the launch will not be finished at the end of the run and must be finished separately.
logLaunchLinkOptionalfalseThis flag allows print the URL of the Launch of the tests in console.
restClientConfigOptionalNot setThe object with agent property for configure http(s) client, may contain other client options eg. timeout.
Visit client-javascript for more details.
tokenDeprecatedNot setUse apiKey instead.

The following options can be overridden using ENVIRONMENT variables:

OptionENV variableNote
apiKeyRP_API_KEY
projectRP_PROJECT_NAME
endpointRP_ENDPOINT
launchRP_LAUNCH
attributesRP_ATTRIBUTESFormat: key:value,key:value,value
descriptionRP_DESCRIPTION
launchIdRP_LAUNCH_ID
modeRP_MODE
tokenRP_TOKENdeprecated Use RP_API_KEY instead.

This is for your convenience if you have a continuous job that runs your tests and may report results that point to a different reportportal project definition, launch name, or attributes.

2. Add script to package.json file:

{
  "scripts": {
    "test": "jest --no-colors --detectOpenHandles --config ./jest.config.js"
  }
}

Features

Retries

The agent has support of retries. Read more about retries in jest.

Licensed under the Apache License v2.0

Contribution

This code was based on the jest-junit and adapted by team members of Ontoforce for the ReportPortal upload. Ontoforce contributed this effort as Open Source to the ReportPortal project team.

Keywords

FAQs

Package last updated on 18 Jul 2023

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