@durable-streams/server-conformance-tests

中文文档
0.3.7发布于 2026/09/11Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 5.6万

Conformance test suite for Durable Streams server implementations

原始使用文档
文档目录9 节
  1. Installation
  2. CLI Usage
  3. Run Once (CI)
  4. Watch Mode (Development)
  5. CLI Options
  6. Programmatic Usage
  7. CI Integration
  8. Test Coverage
  9. License

@durable-streams/server-conformance-tests

Protocol compliance test suite for Durable Streams server implementations.

This package provides a comprehensive test suite to verify that a server correctly implements the Durable Streams protocol.

Installation

npm install @durable-streams/server-conformance-tests
# or
pnpm add @durable-streams/server-conformance-tests

CLI Usage

The easiest way to run conformance tests against your server:

Run Once (CI)

npx @durable-streams/server-conformance-tests --run http://localhost:4437

Watch Mode (Development)

Watch source files and automatically rerun tests when changes are detected:

npx @durable-streams/server-conformance-tests --watch src http://localhost:4437

# Watch multiple directories
npx @durable-streams/server-conformance-tests --watch src lib http://localhost:4437

CLI Options

Usage:
  npx @durable-streams/server-conformance-tests --run <url>
  npx @durable-streams/server-conformance-tests --watch <path> [path...] <url>

Options:
  --run              Run tests once and exit (for CI)
  --watch <paths>    Watch source paths and rerun tests on changes (for development)
  --help, -h         Show help message

Arguments:
  <url>              Base URL of the Durable Streams server to test against

Programmatic Usage

You can also run the conformance tests programmatically within your own test suite:

import { runConformanceTests } from "@durable-streams/server-conformance-tests"

// In your test file (e.g., with vitest)
describe("My Server Implementation", () => {
  const config = { baseUrl: "" }

  beforeAll(async () => {
    // Start your server
    const server = await startMyServer({ port: 0 })
    config.baseUrl = server.url
  })

  afterAll(async () => {
    await server.stop()
  })

  // Run all conformance tests
  runConformanceTests(config)
})

CI Integration

Add conformance tests to your CI pipeline:

# GitHub Actions example
jobs:
  conformance:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "20"

      - name: Install dependencies
        run: npm install

      - name: Start server
        run: npm run start:server &

      - name: Wait for server
        run: npx wait-on http://localhost:4437

      - name: Run conformance tests
        run: npx @durable-streams/server-conformance-tests --run http://localhost:4437

Test Coverage

The conformance test suite covers:

  • Basic Stream Operations - Create, delete, idempotent operations
  • Append Operations - String data, chunking, sequence ordering
  • Read Operations - Empty/full streams, offset reads
  • Long-Poll Operations - Data waiting, immediate returns
  • HTTP Protocol - Headers, status codes, content negotiation
  • TTL and Expiry - TTL/Expires-At handling
  • Case-Insensitivity - Content-type, header casing
  • Content-Type Validation - Match enforcement
  • HEAD Metadata - Metadata-only responses
  • Offset Validation - Malformed offsets, resumable reads
  • Protocol Edge Cases - Empty bodies, binary data, monotonic progression
  • Byte-Exactness - Data integrity guarantees
  • Caching and ETag - ETag and 304 responses
  • Chunking and Large Payloads - Pagination, large files
  • Property-Based Fuzzing - Random append/read sequences
  • Malformed Input Fuzzing - Security-focused tests
  • Read-Your-Writes Consistency - Immediate visibility after writes
  • SSE Mode - Server-sent events streaming
  • JSON Mode - JSON serialization and batching

License

Apache 2.0

版本与发布记录

@durable-streams/server-conformance-tests 共发布 22 个版本,首次发布于 2025/12/24;过去 12 个月发布了 22 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.7latest2026/09/112 个月前
0.3.62026/07/173 个月前
0.3.52026/06/035 个月前
0.3.42026/06/015 个月前
0.3.32026/05/285 个月前
0.3.22026/05/275 个月前

关于 @durable-streams/server-conformance-tests 的常见问题

@durable-streams/server-conformance-tests 是什么?

Conformance test suite for Durable Streams server implementations

如何安装 @durable-streams/server-conformance-tests?

在项目目录运行 npm install @durable-streams/server-conformance-tests,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 server-conformance-tests、durable-streams-server-conformance、durable-streams-server-conformance-dev,可以用 npx server-conformance-tests 直接运行。

@durable-streams/server-conformance-tests 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@durable-streams/server-conformance-tests 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@durable-streams/server-conformance-tests 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@durable-streams/server-conformance-tests 可以商用吗?

@durable-streams/server-conformance-tests 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@durable-streams/server-conformance-tests 的下载量有多少?

根据 npm 官方下载统计,@durable-streams/server-conformance-tests 在 2026/10/13 – 2026/11/11 这 30 天内被下载 56,346 次,日均约 1,878 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@durable-streams/server-conformance-tests 还在维护吗?

最新版本 0.3.7 发布于 2026/09/11(2 个月前);至今共发布 22 个版本,其中过去 12 个月发布了 22 个;首次发布于 2025/12/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。