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

@trading-bot/tests

v1.0.23

Published

## Локальное тестирование * Параллельно запускает все тесты в определенной папке

Downloads

26

Readme

Тесты

Локальное тестирование

  • Параллельно запускает все тесты в определенной папке

Интеграционные тесты:

  • Готовит сокет сервер на порту 7001 и HTTP сервер на порту 3001
  • Создает переменные окружения для апи
  • Логирует в консоль инфу + выводит покрытие кода всего проекта

Установка:

  1. npm i @trading-bot/tests @ava/babel @babel/polyfill @babel/register -D
  2. Определить разделы scripts, ava, nyc файла package.json:
"scripts": {
    "test-local": "test-local",
    "test-integration": "test-integration"
},
"ava": {
    "timeout": "5m",
    "files": [
        "**/*.test.js"
    ],
    "snapshotDir": "__snapshots__",
    "require": [
        "@babel/core",
        "@babel/polyfill",
        "@babel/register"
    ],
    "babel": {
        "testOptions": {
            "presets": [
                "@babel/preset-env"
            ],
            "plugins": [
                "@babel/plugin-transform-runtime"
            ]
        }
    },
    "environmentVariables": {
        "WEBSOCKET_SERVER_PORT": "7001",
        "REST_SERVER_PORT": "3001",
        "BINANCE_WEBSOCKET_MARKET_AGGTRADE": "ws://localhost:7001/marketAggTrade",
        "BINANCE_WEBSOCKET_MARKET_BOOKTICKER": "ws://localhost:7001/marketBookTicker",
        "BINANCE_WEBSOCKET_MARKET_KLINE": "ws://localhost:7001/marketKline",
        "BINANCE_WEBSOCKET_MARKET_PRICE": "ws://localhost:7001/marketPrice",
        "BINANCE_WEBSOCKET_USERDATA_MARGIN": "ws://localhost:7001/userDataMargin",
        "BINANCE_WEBSOCKET_USERDATA_SPOT": "ws://localhost:7001/userDataSpot",
        "BINANCE_REST_USERDATA_LISTENKEY": "http://localhost:3001/userDataListenKey",
        "BINANCE_REST_ACCOUNT_INFORMATION": "http://localhost:3001/accountInformation",
        "BINANCE_REST_MARKET_KLINES": "http://localhost:3001/marketKlines",
        "BINANCE_REST_TRADE_MARGIN_BORROW": "http://localhost:3001/marginBorrow",
        "BINANCE_REST_TRADE_MARGIN_CANCELORDER": "http://localhost:3001/marginCancelOrder",
        "BINANCE_REST_TRADE_MARGIN_NEWORDER": "http://localhost:3001/marginNewOrder",
        "BINANCE_REST_TRADE_SPOT_CANCELORDER": "http://localhost:3001/spotCancelOrder",
        "BINANCE_REST_TRADE_SPOT_NEWORDER": "http://localhost:3001/spotNewOrder",
        "BINANCE_REST_TRADE_SPOT_QUERYORDER": "http://localhost:3001/spotQueryOrder"
    }
},
"nyc": {
    "all": true,
    "check-coverage": true,
    "branches": 100,
    "lines": 100,
    "functions": 100,
    "statements": 100,
    "include": [
        "**/*.js"
    ],
    "exclude": [
        "**/*.test.js"
    ],
    "parser-plugins": [
        "asyncGenerators",
        "bigInt",
        "classProperties",
        "classPrivateProperties",
        "dynamicImport",
        "importMeta",
        "objectRestSpread",
        "optionalCatchBinding"
    ]
},

Команды:

  1. test-local - запуск локальных тестов в определенной папке. Параллельное выполнение.
  2. test-integration - запуск тестов в определенной папке. Можно указать конкретный файл test-integration ./example1.test.js. Последовательное выполнение.

Особенности:

  1. Все пути к любым ресурсам в тестируемом модуле через path.resolve
  2. В проекте названия папок должно быть без пробелов

Примеры в папке examples