- image: cimg/node:current
# Restore previous node package cache if there is one
key: node-{{ checksum "package-lock.json" }}
# Install or update packages
key: node-{{ checksum "package-lock.json" }}
# Store project files for the next job
- image: cimg/node:current
# Start with the initial build
# Optionally add a couple of fields such as the git hash and link to the build
npx testmo automation:resources:add-field --name git --type string \
--value ${CIRCLE_SHA1:0:7} --resources resources.json
npx testmo automation:resources:add-link --name build \
--url $CIRCLE_BUILD_URL --resources resources.json
# Create test run in Testmo and store ID in file
name: Create test run in Testmo
npx testmo automation:run:create \
--name "Parallel mocha test run" \
--resources resources.json \
--source "unit-tests" > testmo-run-id.txt
# Update workspace to persist run ID file
- image: cimg/node:current
# Start with the initial build
# Split & run tests and report results to Testmo
name: Split and run tests
npx testmo automation:run:submit-thread \
--run-id $(cat testmo-run-id.txt) \
--results results/*.xml \
-- npm run mocha-junit-parallel # Note space after --
# Store test artifacts and results
destination: test_results
- image: cimg/node:current
# Start with the initial build
name: Mark run as completed
npx testmo automation:run:complete \
--run-id $(cat testmo-run-id.txt)
- image: cimg/node:current
# Start with the initial build
# You would deploy your code here
- run: echo "Deploying code here"