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

test-jail

v2.2.2

Published

Safely test console programs in Docker containers

Downloads

32

Readme

Test jail logo

Test jail

npm Codecov Docker Image Size (latest semver)

Run C++ and Python programs against input files in a Docker container and save the output to files or compare against valid output.

Read the latest API documentation here

This package was previously called Awesome test runner.
Versions up to v.1.7.x can be installed from https://www.npmjs.com/package/awesome-test-runner

Requires Docker to be installed on your system

API Features

  • Simple, promise based API
  • Buffer support
  • Runs code in a Docker container, preventing local file and process access
  • Uses Docker API (via dockerode)
  • Integrated test queue
  • Tested using Mocha
  • Can run C++ or Python programs (feel free to create an issue requesting a new language)
  • Written fully in TypeScript
  • Documented using JSDoc and TypeDoc

CLI Features

  • Run tests on a program and save output files
  • Test a program using input/output files
  • Print diff (jsdiff or line by line comparison)
  • Single and multiple input modes

CLI Example usage

Install globally using:

npm i test-jail -g

Usage help is available after installation:

test-jail --help

To test if the Docker daemon is running and accessible run:

test-jail ping

The program can then run in two modes:

Run

This mode compiles and runs a program, then passess the specified input files to its standard input. If there was no error, standard output is saved on your file system. Example usage:

test-jail run code.py -i input -o output

Input and output can either be a single file or a directory. All the paths are relative to your current working directory. The input files should have an .in extension. The output files will have the same name, but with an .out extension.

Test

The test mode works similar to the run mode, but instead of saving the standard output to files, it's compared to the files that already exist (they can be generated using the run command on diffirent code, or just written manually), and the difference is shown.

test-jail test code.py -i input -o output