# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

orbs:
  # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
  node: circleci/node@5.1.0

jobs:
  build-and-test:
    # These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/
    # https://circleci.com/developer/images/image/cimg/node
    docker:
      - image: cimg/node:20.8.1
    steps:
      - checkout
      - node/install-packages:
          pkg-manager: npm
      - run:
          name: Build project
          command: npm run build
      - run:
          name: Run tests
          command: npm run test

workflows:
  # Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
  # CircleCI will run this workflow on every commit.
  # https://circleci.com/docs/2.0/configuration-reference/#workflows
  TestRunner:
    jobs:
      - build-and-test
