@fakehost/signalr

中文文档
1.0.0-beta.3发布于 2023/10/04MITTypeScriptESM + CJS近 30 天下载 6111

A Fake Signalr Service for faking/mocking signalr hub services for testing, prototyping, and demoing

原始使用文档

@fakehost/signalr

NPM Version

A fake version of the Signalr protocol.

See the docs for more info.

  • can be run as a localhost service, or bundled within a web browser.
  • used for testing client side ui code deeply against a known (fake) backend
  • contract tests to ensure the fake matches the remote
  • supports JSON and message pack wire protocols

Best place to look is the at the test fake service

See also

See testing in Playwright for playwright setup.

See testing in cypress for cypress setup.

See bundling fakes in a web application for creating standalone demo apps, or similar e.g storybook.

See running as a local service

## Tests

As @fakehost/signalr is a fake version of a real dotnet signalr service.

  1. There is a real signalr server signalr-test-dotnet-svc. This is a real dotnet signalr service. We use a typescript client generation tool TypedSignalR to generate a typescript client library for calling this remote service. This generate code is outputted to signalr-test-client-api

  2. There is a fake implementation of the hubs from the dotnet service signalr-test-dotnet-svc in the signalr-test-fake-svc. This is a nodejs fake implementations of the real dotnet services.

  3. Along with the fake implementation in signalr-test-fake-svc there are contract tests for each hub. These contract tests run against the fakes (yarn test) and are also run against the real dotnet service (yarn test:contract). This ensures that fake version has the exact same behaviour as the real dotnet service, and as such:

The @fakehost/signalr behaves identically to a real dotnet signalr service

License

@fakehost/signalr is licensed under the MIT License.

版本与发布记录

@fakehost/signalr 共发布 4 个版本,首次发布于 2023/08/07;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0-beta.3latest2023/10/043 年前
1.0.0-beta.22023/10/043 年前
1.0.0-beta.12023/10/023 年前
1.0.0-beta.02023/08/073 年前

关于 @fakehost/signalr 的常见问题

@fakehost/signalr 是什么?

A Fake Signalr Service for faking/mocking signalr hub services for testing, prototyping, and demoing

如何安装 @fakehost/signalr?

在项目目录运行 npm install @fakehost/signalr,或使用 pnpm add / yarn add / bun add。

@fakehost/signalr 支持 TypeScript 吗?

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

@fakehost/signalr 支持 ESM 还是 CommonJS?

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

@fakehost/signalr 可以商用吗?

@fakehost/signalr 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fakehost/signalr 的下载量有多少?

根据 npm 官方下载统计,@fakehost/signalr 在 2026/10/14 – 2026/11/12 这 30 天内被下载 6,111 次,日均约 204 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fakehost/signalr 还在维护吗?

最新版本 1.0.0-beta.3 发布于 2023/10/04(3 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/08/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。