运行

Shards and JUnit

Split a big suite across machines, join the results, and report to any CI with JUnit.

本页还没有中文版,下面是英文原文。

A suite that takes too long on one machine can run across several. Each machine runs a share of the test files, and one job joins the results.

Split the suite

--shard 2/4 runs the second of four shares. Each share is every fourth test file, so the four machines together run them all.

.github/workflows/danwo.yml · the shards
strategy:
  matrix:
    shard: [1, 2, 3, 4]
steps:
  - run: npx @danwo/cli test --shard ${{ matrix.shard }}/4
  - uses: actions/upload-artifact@v4
    with: { name: "results-${{ matrix.shard }}", path: .danwo/results }

Each shard keeps its results in .danwo/results/. A shard posts no pull request comment.

Join the results

In a later job, download every results-* artifact into .danwo/results, then merge:

.github/workflows/danwo.yml · the merge
- uses: actions/download-artifact@v4
  with: { pattern: "results-*", path: .danwo/results, merge-multiple: true }
- run: npx @danwo/cli merge-reports --reporter github
  env:
    GITHUB_TOKEN: ${{ github.token }}

merge-reports posts one check and one comment for the whole run.

Rerun what failed

--last-failed runs only what failed in the latest run, and merges into it:

npx @danwo/cli test --last-failed

A test that failed before and passes now is reported once, as flaky. A test that fails and then passes on a retry in the same run is flaky too: it passes the run, and the summary and the check say so.

JUnit for other CIs

npx @danwo/cli test --reporter junit

That writes .danwo/junit.xml, which GitLab, Jenkins, CircleCI and Buildkite read.

Stop early

--max-failures 5 starts no new test file once five tests have failed.

Next

本页内容

在每个 Pull Request 上运行

每个 Pull Request 一个 GitHub Check 和一条评论,并附上完整的运行记录。

配置 CI