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

@kidoweb/netron

v1.1.0

Published

A Jest-based network testing framework with Postman-like functionality

Downloads

6

Readme

Netron

Netron - это мощный Node.js модуль для тестирования компьютерных сетей, который сочетает в себе удобство Jest с функциональностью Postman. Модуль позволяет легко создавать и выполнять тесты сетевых запросов с богатым набором возможностей.

Особенности

  • 🚀 Поддержка всех основных HTTP методов (GET, POST, PUT, DELETE, PATCH)
  • 📊 Отслеживание истории запросов с метриками производительности
  • 🔄 Перехватчики запросов и ответов
  • 🔒 Встроенная поддержка аутентификации
  • 🌐 Настройка прокси и редиректов
  • ⏱️ Настраиваемые таймауты
  • 🧪 Полная интеграция с Jest
  • 📝 Подробное логирование и отладка

Установка

npm install netron

Использование

Базовое использование

const NetworkTester = require('netron');

describe('API Tests', () => {
  let tester;

  beforeEach(() => {
    tester = new NetworkTester();
    tester.setBaseURL('https://api.example.com');
  });

  test('should get user data', async () => {
    const response = await tester.get('/users/1');
    expect(response.status).toBe(200);
    expect(response.data).toHaveProperty('name');
  });
});

Настройка заголовков и аутентификации

tester.setDefaultHeaders({
  'Authorization': 'Bearer token123',
  'Content-Type': 'application/json'
});

tester.setAuth({
  username: 'user',
  password: 'pass'
});

Использование перехватчиков

// Перехватчик запросов
tester.addRequestInterceptor(config => {
  config.headers['X-Custom-Header'] = 'value';
  return config;
});

// Перехватчик ответов
tester.addResponseInterceptor(response => {
  console.log(`Request to ${response.config.url} took ${response.duration}ms`);
  return response;
});

Отслеживание истории запросов

// Получение истории запросов
const history = tester.getRequestHistory();
console.log(history);

// Очистка истории
tester.clearRequestHistory();

Настройка прокси и таймаутов

tester.setProxy({
  host: 'proxy.example.com',
  port: 8080
});

tester.setTimeout(5000); // 5 секунд
tester.setMaxRedirects(3);

API

Основные методы

  • get(url, config)
  • post(url, data, config)
  • put(url, data, config)
  • delete(url, config)
  • patch(url, data, config)

Конфигурация

  • setBaseURL(baseURL)
  • setDefaultHeaders(headers)
  • setTimeout(timeout)
  • setAuth(auth)
  • setProxy(proxy)
  • setMaxRedirects(maxRedirects)

Перехватчики

  • addRequestInterceptor(interceptor)
  • addResponseInterceptor(interceptor)

История запросов

  • getRequestHistory()
  • clearRequestHistory()

Примеры тестов

Тестирование REST API

describe('REST API Tests', () => {
  let tester;

  beforeEach(() => {
    tester = new NetworkTester();
    tester.setBaseURL('https://api.example.com');
  });

  test('CRUD operations', async () => {
    // Create
    const createResponse = await tester.post('/users', {
      name: 'John Doe',
      email: '[email protected]'
    });
    expect(createResponse.status).toBe(201);
    const userId = createResponse.data.id;

    // Read
    const getResponse = await tester.get(`/users/${userId}`);
    expect(getResponse.status).toBe(200);
    expect(getResponse.data.name).toBe('John Doe');

    // Update
    const updateResponse = await tester.put(`/users/${userId}`, {
      name: 'John Updated'
    });
    expect(updateResponse.status).toBe(200);
    expect(updateResponse.data.name).toBe('John Updated');

    // Delete
    const deleteResponse = await tester.delete(`/users/${userId}`);
    expect(deleteResponse.status).toBe(200);
  });
});

Тестирование производительности

test('API performance', async () => {
  const startTime = Date.now();
  
  await tester.get('/users');
  
  const history = tester.getRequestHistory();
  const requestDuration = history[0].duration;
  
  expect(requestDuration).toBeLessThan(1000); // Менее 1 секунды
});

Лицензия

MIT