#!/bin/bash

# cd to where script is located, so it can be called from anywhere
cd "$( dirname "${BASH_SOURCE[0]}" )"
cd ..

export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)

# pass the test suite when invoking eg: "yarn run debug-docker test/video-segments.spec.ts"
TEST_SUITE="$1"

# in theory, should use inspect-brk, in practice there is ample time to attach the debugger until the app initializes
docker-compose -f test-docker.yml run --service-ports test-docker \
  npx mocha --config test/config/.mocharc.yml --inspect=0.0.0.0 "$TEST_SUITE"
