Bitbucket Pipelines

Add VISUALCI_TOKEN (a project token) as a secured repository variable. The CLI reads the commit from BITBUCKET_COMMIT, the branch from BITBUCKET_BRANCH and the pull request from BITBUCKET_PR_ID.

pipelines:
  default:
    - step:
        name: Test
        image: node:24
        script:
          - curl -fsSL https://visualci.com/install.sh | VISUALCI_VERSION=0.2.5 VISUALCI_INSTALL_DIR=/usr/local/bin sh
          - 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

Bitbucket clones 50 commits deep by default. That's enough history for VisualCI to find the base build; set clone: depth: full if branches live longer.

Parallel steps

Parallel steps share one build through a nonce and finalize their own shard:

- parallel:
    - step:
        script:
          - export VISUALCI_BUILD_ID=$(visualci build create --nonce "$BITBUCKET_BUILD_NUMBER" --shards 2)
          - npm run test:unit -- -u && visualci upload --from auto src
          - visualci build finalize --shard 0
    - step:
        script:
          - export VISUALCI_BUILD_ID=$(visualci build create --nonce "$BITBUCKET_BUILD_NUMBER" --shards 2)
          - npm run test:e2e && visualci upload screenshots
          - visualci build finalize --shard 1

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