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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tramvai/test-integration

v6.79.7

Published

Set of helpers to simplify the process of writing integration tests for the tramvai app. Implies full-fledged run of the app with build made by `@tramvai/cli` and use of helpers for test result of requests to the server and test render of the app in the b

Downloads

2,648

Readme

Tramvai test integration

Set of helpers to simplify the process of writing integration tests for the tramvai app. Implies full-fledged run of the app with build made by @tramvai/cli and use of helpers for test result of requests to the server and test render of the app in the browser.

The @tramvai/cli package is required and should be installed manually

Installation

npm i --save-dev @tramvai/test-integration

How To

Test request to the tramvai app without using browser (aka curl)

For testing requests to the tramvai app libraries superagent and node-html-parser are used under hood.

Call of app.request sends requests to the app. All features of superagent are available.

Call of app.render resolves to the HTML render that is returned from server while serving the request.

import { startCli } from '@tramvai/test-integration';

beforeAll(async () => {
  app = await startCli('bootstrap', {
    env: {
      SOME_ENV: 'test',
    },
  });
}, 80000);

afterAll(() => {
  return app.close();
});

it('request to main page should return status 200', async () => {
  return app.request('/').expect(200);
});

it('main page HTML snapshot', async () => {
  const parsed = await app.render('/');
  const applicationInnerHtml = parsed.application;

  expect(parsed.application).toMatchInlineSnapshot();
});

Testing app in browser with the playwright

You may use another library @tramvai/test-pw to implement testing in the browser.

Usage of @tinkoff/mocker in tests

In order to use mocker there should be added @tramvai/module-mocker to the tramvai app modules list.

After thar mocker will read file based mocks as it described in the docs to the mocker itself and it can be used dynamically in the tests:

it('should work with mocker', async () => {
  await app.mocker.addMocks('CONFIG_API', {
    'GET /test/': {
      status: 200,
      payload: {
        status: 'OK',
        response: 'smth',
      },
    },
  });

  await app.request('/api/').expect(200);

  await app.papi.clearCache();
  await app.mocker.removeMocks('CONFIG_API', ['GET /test/']);

  await app.request('/api/').expect(500);
});

Papi methods

All papi methods can be used in tests, for example:

import { startCli } from '@tramvai/test-integration';

it('environment list', async () => {
  const { papi } = await startCli('papi-example');

  const response = await papi.apiList();
});

Available methods are:

  • clearCache;
  • bundleInfo;
  • apiList;

Also, you can use publicPapi (passes to ${serverUrl}/${appName}/papi/) and privatePapi (passes to ${serverUrl}/${appName}/private/papi/) properties to work with your own papi methods:

import { startCli } from '@tramvai/test-integration';

it('custom method', async () => {
  const { papi } = await startCli('papi-example');

  const response = await papi.publicPapi('whatever');
});