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

infra-api-test

v1.0.0

Published

Infrastructure layer for API test automation

Downloads

11

Readme

Infra API Test Library

Infrastructure layer for API test automation providing reusable utilities for test response logging and parameter management.

Overview

This library provides common utilities for API testing projects:

  • Test Response Logger: Save and retrieve test responses for debugging and cross-test parameter usage
  • JSON Parameter Processor: Process parameter references in JSON test files using {{ref:TEST_NAME:PARAMETER_PATH}} syntax

Project Structure

infra-api-test/
├── src/
│   ├── utils/
│   │   ├── json-parameter-processor.ts  # JSON parameter reference processing
│   │   └── test-response-logger.ts      # Test response logging and retrieval
│   └── index.ts                         # Main exports
├── .clinerules/                          # Cline AI workflow rules
│   └── workflows/
│       ├── tester-grpc.md               # gRPC test generation rules
│       └── tester-rest.md               # REST API test conversion rules
├── dist/                                # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md

Installation

This library is installed as a local file dependency in the consuming project:

{
  "dependencies": {
    "infra-api-test": "file:../infra-api-test"
  }
}

Then run:

npm install

Usage

Importing Utilities

import {
  // Test Response Logger
  logAndSaveTestResponse,
  getParameterFromPreviousTest,
  saveAllTestResponses,
  TestResponse,
  TestResponseLogger,
  
  // JSON Parameter Processor
  processJsonParameterReferences,
  hasJsonParameterReferences,
  validateParameterReferences,
  extractParameterReferences
} from 'infra-api-test';

Test Response Logging

import { logAndSaveTestResponse, saveAllTestResponses } from 'infra-api-test';

describe('My Test Suite', () => {
  afterAll(() => {
    saveAllTestResponses('my-test-responses.json');
  });

  test('Should save response', async () => {
    const testName = 'Should save response';
    const response = await makeApiCall();
    
    // Log and immediately save the response
    logAndSaveTestResponse(testName, response, 'my-test-responses.json');
    
    expect(response.status).toBe(200);
  });
});

Cross-Test Parameter Usage

import { getParameterFromPreviousTest } from 'infra-api-test';

test('Should use parameter from previous test', async () => {
  const testName = 'Should use parameter from previous test';
  
  // Get parameter from previous test response
  const savedToken = getParameterFromPreviousTest(
    'Login Test',
    'token',
    'my-test-responses.json'
  );
  
  // Use in new request
  const headers = { 'Authorization': `Bearer ${savedToken}` };
  const response = await makeApiCall(headers);
  
  logAndSaveTestResponse(testName, response, 'my-test-responses.json');
});

JSON Parameter References

import { 
  hasJsonParameterReferences, 
  processJsonParameterReferences 
} from 'infra-api-test';

const testData = {
  userId: "{{ref:User Creation Test:user.id}}",
  token: "{{ref:Login Test:token}}"
};

if (hasJsonParameterReferences(testData)) {
  const processed = processJsonParameterReferences(
    testData,
    'my-test-responses.json'
  );
  // Use processed data with real values
}

Cline Rules

The .clinerules folder contains AI-assisted workflow rules for:

  • tester-grpc.md: Automatic gRPC test generation from proto files and JSON test definitions
  • tester-rest.md: Postman collection to Jest test conversion guidelines

These rules ensure consistent test generation and follow best practices.

Development

Building the Library

npm run build

Watching for Changes

npm run watch

Cleaning Build Output

npm run clean

Consuming Projects

Projects using this library should:

  1. Install it as a file dependency
  2. Import utilities from 'infra-api-test'
  3. Follow the cline rules in .clinerules/workflows/ for test generation
  4. Use the test response logger for all test cases
  5. Leverage cross-test parameter usage for dependent tests

Features

Test Response Logger

  • Immediate Saving: Responses are saved immediately after each test
  • Cross-Test Parameters: Retrieve values from previous test responses
  • Dot Notation: Support for nested object and array access (e.g., user.data[0].id)
  • Error Handling: Comprehensive error messages with available parameter paths
  • Suite Organization: Save responses per test suite for better organization

JSON Parameter Processor

  • Reference Syntax: {{ref:TEST_NAME:PARAMETER_PATH}}
  • Nested Access: Support for dot notation and array indexing
  • Validation: Validate parameter references before processing
  • Extraction: Extract all parameter references for analysis
  • Error Handling: Detailed error messages for missing tests or parameters

Version

Current version: 1.0.0

License

MIT