npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jest-qase-reporter

v2.0.3

Published

Qase TMS Jest Reporter

Downloads

2,900

Readme

Qase TestOps Jest reporter

Qase Jest reporter sends test results and metadata to Qase.io. It can work in different test automation scenarios:

  • Create new test cases in Qase from existing autotests.
  • Report Jest test results to existing test cases in Qase.

Testing frameworks that use Jest as a test runner, such as Puppeteer, Appium, and Detox, can also be used with Jest reporter.

To install the latest version, run:

npm install --save-dev jest-qase-reporter

Contents

Getting started

To report your tests results to Qase, install jest-qase-reporter, and add a reporter config in the jest.config.ts file. A minimal configuration needs just two things:

  • Qase project code, for example, in https://app.qase.io/project/DEMO the code is DEMO.
  • Qase API token, created on the Apps page.
module.exports = {
  reporters: [
    'default',
    [
      'jest-qase-reporter',
      {
        mode: 'testops',
        testops: {
          api: {
            token: 'api_token'
          },
          project: 'project_code',
        },
      },
    ],
  ],
};

Now, run the Jest tests as usual. Test results will be reported to a new test run in Qase.

$ npx jest
Determining test suites to run...
...
qase: Project DEMO exists
qase: Using run 42 to publish test results
...

Ran all test suites.

Using Reporter

The Jest reporter has the ability to auto-generate test cases and suites from your test data.

But if necessary, you can independently register the ID of already existing test cases from TMS before the executing tests. For example:

Metadata

  • qase.title - set the title of the test case
  • qase.fields - set the fields of the test case
  • qase.suite - set the suite of the test case
  • qase.comment - set the comment of the test case
  • qase.parameters - set the parameters of the test case
  • qase.groupParameters - set the group parameters of the test case
  • qase.ignore - ignore the test case in Qase. The test will be executed, but the results will not be sent to Qase.
  • qase.step - create a step in the test case
  • qase.attach - attach a file to the test case
const { qase } = require('jest-qase-reporter/jest');

describe('My First Test', () => {
  test(qase([1, 2], 'Several ids'), () => {
    expect(true).toBe(true);
  });

  test(qase(3, 'Correct test'), () => {
    qase.title('Title');
    expect(true).toBe(true);
  });

  test.skip(qase('4', 'Skipped test'), () => {
    expect(true).toBe(true);
  });

  test(qase(['5', '6'], 'Failed test'), () => {
    expect(true).toBe(false);
  });
});

To run tests and create a test run, execute the command (for example from folder examples):

QASE_MODE=testops npx jest

or

npm test

A test run will be performed and available at:

https://app.qase.io/run/QASE_PROJECT_CODE

Configuration

Reporter options (* - required):

  • mode - testops/off Enables reporter, default - off
  • debug - Enables debug logging, default - false
  • environment - To execute with the sending of the envinroment information
  • *testops.api.token - Token for API access, you can find more information here
  • *testops.project - Qase project code, for example, in https://app.qase.io/project/DEMO the code is DEMO
  • testops.run.id - Qase test run ID, used when the test run was created earlier using CLI or API call.
  • testops.run.title - Set custom Run name, when new run is created
  • testops.run.description - Set custom Run description, when new run is created
  • testops.run.complete - Whether the run should be completed

Example jest.config.js config:

module.exports = {
  reporters: [
    'default',
    [
      'jest-qase-reporter',
      {
        mode: 'testops',
        testops: {
          api: {
            token: 'api_key'
          },
          project: 'project_code',
          run: {
            complete: true,
          },
        },
        debug: true,
      },
    ],
  ],
  ...
};

You can check example configuration with multiple reporters in example project.

Supported ENV variables:

  • QASE_MODE - Same as mode
  • QASE_DEBUG - Same as debug
  • QASE_ENVIRONMENT - Same as environment
  • QASE_TESTOPS_API_TOKEN - Same as testops.api.token
  • QASE_TESTOPS_PROJECT - Same as testops.project
  • QASE_TESTOPS_RUN_ID - Pass Run ID from ENV and override reporter option testops.run.id
  • QASE_TESTOPS_RUN_TITLE - Same as testops.run.title
  • QASE_TESTOPS_RUN_DESCRIPTION - Same as testops.run.description

Requirements

We maintain the reporter on LTS versions of Node. You can find the current versions by following the link

jest >= 28.0.0