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 🙏

© 2025 – Pkg Stats / Ryan Hefner

integratify

v6.0.0

Published

Make integration testing easy

Downloads

76

Readme

Integratify

Make Node.js integration testing easy!

npm version Dependencies API Continuous Integration

Installation

Install via npm

npm install integratify

or via yarn

yarn add integratify

Usage

const integratify = require('integratify');
import * as integratify from 'integratify';

Configuration

Global

You can set a global configuration that will used for all tests. Adviced to set this in a configuration file running before each test file. This is optional

import { setConfiguration } from 'integratify';

setConfiguration({
  dataPath: 'data',
  schemaValidator: (data, schema) => myValidationFunc(data, schema),
});

Local

You can always overwrite any global configuration per test suite when initializing your Integratify test runner.

const express = require('express');
const app = express();

const testRunner = integratify(app, {
  prefix: '/api/auth', // Optional prefix for every url path
  dataPath: 'data', // Optional path where actual data will be placed on.
  schemaValidator: (data, schema) => myValidationFunc(data, schema), // Function to validate data against a schema
});

Getting Started

Run api tests

// test.config.ts
import { setConfiguration } from 'integratify';

setConfiguration({
  dataPath: 'data',
  schemaValidator: (data, schema) => myValidationFunc(data, schema),
});


// login.test.ts
const testRunner = integratify(app, {
  prefix: '/auth',
  dataPath: 'customDataPath', // Will overwrite global setting
});

describe('POST /login', () => {
  it('Should successfully log in existing user', async () => {
    const { status, header, body } = await testRunner
      .post("/login")
      .send({
        payload: { username, password }, // Optional body
        query: { ... }, // Optional query parameters
        headers: { ... }, // Optional headers
        file: { name: 'fileName.png', value: '...' }, // Optional file
      })
      .expect({
        status: 200,
        schema: loginOutsputSchema,
        matchObject: { username: expect.any(String)}
        matchObjectInArray:  { username: expect.any(String)},
        toEqual:  { username: expect.any(String)};
        length: 1,
        spies: [
          fetchSpy, // Will validate whether called once
          { spy: firebaseSpy, amount: 1 },
        ],
        error: new BadRequestError(errors.THIS_WAS_NOT_OK),
        paths: [
          { 'meta.count': 10 },
          { 'meta.totalCount': 250 },
        ]
      });
  });
});

Available Options

.post .get .put .patch .delete

| Key | Type | Description | Allowed value(s) | | ------- | ------------- | -------------- | ------------------------------ | | payload | string/object | Body payload | any string/object | | query | string/object | Query payload | any string/object | | headers | object | Custom headers | any object | | file | object | File payload | { name: string, value: any } |

.expect

| Key | Type | Description | Allowed value(s) | | ------------------ | ------ | ---------------------------------------------- | ------------------------------------------------------------ | | status | number | HTTP status | valid HTTP status code | | schema | any | Validation schema | Expected schema for schemaValidator configuration property | | matchObject | object | .toMatchObject | any object | | matchObjectInArray | object | Matches an object within an array | any object | | toEqual | any | .toEqual | any | | length | number | Matches length of response | number | | spies | object | Checks whether specific spies got called | [mySpy] or [{ spy: mySpy, amount: 2 }] | | error | Error | Potential error to validate against | Javascript Error | | paths | object | Validate custom return keys besides dataPath | {'meta.count': 1} |

Error support for @tree-house/errors.

To Do

Unfortunately no time could be found yet to add automated tests. This is the first thing planned now we have a stable version 3 released.

Tests

You can run npm run test to run all tests You can run npm run test:coverage to run all tests with coverage report

Authors

See the list of contributors who participated in this project.

License

This project is licensed under the ISC License - see the LICENSE.md file for details