I'm currently writing local integrations tests using Jest, Docker, and the dynamodb-local container.
I do this by starting the container and then jest --watchAll --coverage --runInBand so that the tests run sequentially and don't interrupt one another.
I was using GitHub Actions to run the unit tests, but I'd like to continue to use the GitHub Actions for these integration tests as well. The current one I have can't run NPM. How do I configure the action properly?
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
push:
branches:
- "main"
# OLD UNIT TESTS that worked
# jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 12
# - run: npm ci
# - run: npm test
jobs:
vm:
runs-on: ubuntu-latest
steps:
- run: |
echo This job does not specify a container.
echo It runs directly on the virtual machine.
name: Run on VM
container:
runs-on: ubuntu-latest
container: amazon/dynamodb-local
steps:
name: Run in container
- run: npm ci
- run: npm test