@aj-shadow/actorjs-app

中文文档
0.0.0-aj-beta.275发布于 2026/11/04MIT零依赖近 30 天下载 3841

Library used by @aj-shadow/actorjs

原始使用文档
文档目录13 节
  1. Trigger, mock, and intercept anything.
  2. Prerequisites
  3. Install ActorJs
  4. Update ActorJs
  5. Build ActorJs Server
  6. Start ActorJs Client
  7. Documentation
  8. Further reading in the ActorJs tool
  9. Example code
  10. HTTP - server
  11. Websocket - client
  12. Puppeteer - client
  13. Socket - server

ActorJs

ActorJs is a tool for end-to-end testing that you run in a browser.

Trigger, mock, and intercept anything.

ActorJs simulates all processes and services surrounding a System Under Test, allowing you to isolate a System Under Test in a very efficient way, no matter how many surrounding systems or protocols the System Under Test needs to use. You create Actors (very small simulators) that use stacks for communication.

Prerequisites

Nodejs – 20.x.x or later Git – 2.26.0 or later

Install ActorJs

npm install @actorjs/actorjs

Update ActorJs

npm update

Build ActorJs Server

aj release

If you make changes to files, but ActorJs has not been started, or if you pull updates from your local repos, you must build the server again using aj release. Otherwise, just use aj to start ActorJs.

Linux & Mac: To use the command aj, an alias is needed for the actorjs.sh file in the installation folder. During installation, aliases are added to .bashrc (Linux and Mac) and .zshrc (Mac). If you use another shell, you have to add the alias yourself. The first time you install ActorJs, you need to restart the terminal or source the file containing the alias, for instance:

source ~/.bashrc

Start ActorJs Client

Open a browser with the url http://localhost:9005

Documentation

Further reading in the ActorJs tool

The ActorJs documentation can be found in the tool. To access it, click the following links when the tool is running.

Example code

HTTP - server

*run() {
  this.httpConnection.send(new HttpMsgGetRequest(this.requistUri));
    
  const response = this.httpConnection.receive();
  VERIFY_VALUE(HttpApi.StatusCode.OK, response.statusCode, ' HTTP response line status code:');
  VERIFY_CONTENT_OPTIONAL('content-name', response.getHeaderNumber(HttpApi.Header.CONTENT_LENGTH), response.getBody());
}

Websocket - client

*run() {
  this.httpConnection.send(new HttpGetUpgradeRequest(this.requistUri, this.wsProtocol));
 
  const response = this.httpConnection.receive();
  this.websocketConnection = this.switchProtocol('websocket', this.httpConnection);
    
  this.websocketConnection.send(new WebsocketStackApi.TextFrame(this.wsText, this.wsMask));
  this.websocketConnection.send(new WebsocketStackApi.CloseFrame());
}

Puppeteer - client

*run() {
  const page = this.puppeteerConnection.page;
  yield page.click('.w-button');
}

Socket - server

*run() {
  this.socketConnection.accept();
  const request = this.socketConnection.receiveLine();
  VERIFY_VALUE('Hello World!', request)
}

版本与发布记录

@aj-shadow/actorjs-app 共发布 42 个版本,首次发布于 2026/03/26;过去 12 个月发布了 42 个版本。

版本发布日期距今
0.0.0-aj-beta.275latest2026/11/042 天前
0.0.0-aj-beta.2732026/11/042 天前
0.0.0-aj-beta.2722026/10/1918 天前
0.0.0-aj-beta.2712026/10/1819 天前
0.0.0-aj-beta.2702026/10/1522 天前
0.0.0-aj-beta.2692026/10/1225 天前

关于 @aj-shadow/actorjs-app 的常见问题

@aj-shadow/actorjs-app 是什么?

Library used by @aj-shadow/actorjs

如何安装 @aj-shadow/actorjs-app?

在项目目录运行 npm install @aj-shadow/actorjs-app,或使用 pnpm add / yarn add / bun add。

@aj-shadow/actorjs-app 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/aj-shadow__actorjs-app 是否存在。

@aj-shadow/actorjs-app 可以商用吗?

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

@aj-shadow/actorjs-app 的下载量有多少?

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

@aj-shadow/actorjs-app 还在维护吗?

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