Travis CI

Add VISUALCI_TOKEN (a project token) as a repository environment variable, hidden from the build log. The CLI reads the commit from TRAVIS_PULL_REQUEST_SHA or TRAVIS_COMMIT, the branch from TRAVIS_PULL_REQUEST_BRANCH or TRAVIS_BRANCH, and the pull request from TRAVIS_PULL_REQUEST.

language: node_js
node_js: lts/*
git:
  depth: false
install:
  - npm ci
  - curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.5 VISUALCI_INSTALL_DIR="$HOME/bin" sh
script:
  - export PATH="$HOME/bin:$PATH"
  - export VISUALCI_BUILD_ID=$(visualci build create)
  - npm test -- -u # write snapshots instead of failing; see the snapshot guides
  - visualci upload --from auto src tests
  - visualci build finalize

git: depth: false gives VisualCI the commit's history, so a branch compares with the build it started from.

See Other CI providers for the environment variables and how shards work.