GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - OS-Guild/docker-compose-jest-runner: This package allows to run tests that use docker-compose and supports multi-stage setup.

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

docker-compose-jest-runner

This package allows to run tests that use docker-compose and supports multi-stage setup.

How it works?

This runner creates docker-compose services in stopped state and then starts them accordingly to the stages. It will start the new stage only when all the services on current one will be running. When all the stages are done the actual Jest tests will be run. After the tests will be completed the services will be teared down.

Setup

  1. Run npm install --save-dev docker-compose-jest-runner
  2. Add dc-jest-runner.yml to the root repo or use DC_JEST_RUNNER_CONFIG environment variable for path to the config file.
  3. Add runner: docker-compose-jest-runner to jest.config.js file.

That's all

Configuration

  files: string | string[] (optional, default 'docker-compose.yaml') # docker-compose yaml files
  skipPull: boolean (optional, default false) # skips pulling docker images
  skipBuild: boolean (optional, default false) # skips building docker images
  timeout: number (optional, default Infinity) # maximum time in ms to wait for service on each stage
  interval: number (optional, default 250) # interval to check service in ms
  stages:
    - name: string
      services:
        - name: string # should be exactly as in docker-compose files
          timeout: number (optional, defaults to stage's value)
          interval: number (optional, defaults to stage's value)
          logs: boolean (optional, default false) # if "true" prints the container logs after tests execution
          check: string or object # based on `wait-on` npm package
            protocol: tcp | http | https | http-get | https-get
            port: number (optional, default 80 for http and 443 for https)
            path: string

Look here for more details regarding service check definition.

Example

files:
  - ./tests/docker-compose.yml
timeout: 2000
interval: 100
stages:
  - name: Infra
    services:
      - name: mongo
        check: 'tcp:localhost:27017'
  - name: Service
    services:
      - name: api
        logs: true
        check:
          port: 3000
          protocol: http-get
          path: /posts

Contributing

Requirements

  1. Docker

  2. NodeJS

Getting started

  1. Clone the repo:

    git clone [email protected]:AleF83/docker-compose-jest-runner.git
  2. Install npm packages:

    npm ci
  3. Build the project:

    npm run build
  4. Run tests:

    npm run test

About

This package allows to run tests that use docker-compose and supports multi-stage setup.

Resources

Readme
MIT license
Activity
Custom properties

Stars

28 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.