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

@giltayar/microservices-were-made-for-testing

v1.0.12

Published

Companion code to the "These microservices were made for testing, and testing is what we'll do" talk.

Downloads

7

Readme

microservices-were-made-for-testing

Companion code to the "These microservices were made for testing, and testing is what we'll do" talk.

You can find the talk slides at http://bit.ly/microservices-were-made-for-testing-jsil

This package is a microservice, complete with testing, that gives CRUD functionality to a "tenants" database.

Installing

  • This package is meant to be used as a docker container, passing the environment variables as defined below.
docker run -d -e "DATABASE_CONNECTION_STRING=..." giltayar/microservices-were-made-for-testing
  • see test/e2e/docker-compose.yml for an example run used in the end to end tests.

  • Alternatively, it can be run using ./scripts/run-microservices-were-made-for-testing.js, using the environment variables as defined below.

npm install @giltayar/microservices-were-made-for-testing
export DATABASE_CONNECTION_STRING=...
npx run-microservices-were-made-for-testing
  • Alternatively, you can import it and create the app (see below), passing it the configuration as defined below.
npm install @giltayar/microservices-were-made-for-testing

Services it depends on

  • Postgres: you don't need to install Postgres to run the tests, but you will need it in a production environment.

Using the package to run the application

const createApp = require('@giltayar/microservices-were-made-for-testing')

// configuration options aee the same as the above corresponding environment variables
const app = createApp({databaseConnectionString: '...'})

// app is a fastify app. Use listen to start it in the usual way for [fastify](https://fastify.io)
await app.listen(/*...*/)

You can see an example of such use in test/commons/setup.js.

Building and Testing

To build and test it:

npm ci
npm run build # Builds the docker image
npm test # Tests the microservice

Tests

Tests can be found in the test folder, where there are three folders:

  • unit: for the unit tests
  • it: for the integration tests, where I run the app using require and HTTP against it to check it
  • e2e: for the "e2e" tests, where I run the app using its docker container and HTTP against it to check it

Publishing

To publish the microservice, do:

npm publish

This will publish both the NPM package and the microservice.