@alienplatform/testing

中文文档
3.3.54发布于 2026/11/05FSL-1.1-Apache-2.0TypeScriptES Module近 30 天下载 3799

Testing framework for Alien applications

原始使用文档
文档目录7 节
  1. Install
  2. Local vs Cloud
  3. Local Mode
  4. Cloud Mode
  5. API
  6. Configuration
  7. Notes

@alienplatform/testing

Testing framework for Alien applications.

Install

npm install --save-dev @alienplatform/testing

Local vs Cloud

This package has two deployment modes:

  • local mode uses alien dev
  • cloud mode uses the platform API

That split is intentional. Local mode stays centered on the shipped alien CLI binary instead of asking users to discover lower-level manager binaries.

Local Mode

Local mode is the default:

import { afterAll, beforeAll, describe, expect, it } from "vitest"
import { deploy, type Deployment } from "@alienplatform/testing"

describe("My App", () => {
  let deployment: Deployment

  beforeAll(async () => {
    deployment = await deploy({ app: "./my-app" })
  }, 300_000)

  afterAll(async () => {
    await deployment?.destroy()
  })

  it("responds to requests", async () => {
    const response = await fetch(`${deployment.url}/api/hello`)
    expect(response.status).toBe(200)
  })
})

Under the hood the package:

  1. finds the alien binary
  2. spawns alien dev --status-file ...
  3. waits for the status file to report readiness
  4. reads the public URL and commands URL from that file

The local machine contract is the DevStatus JSON written by alien dev, not terminal output.

Cloud Mode

Cloud mode targets real infrastructure:

const deployment = await deploy({
  app: "./my-app",
  platform: "aws",
})

Supported cloud platforms:

  • aws
  • gcp
  • azure

Cloud mode requires ALIEN_API_KEY.

API

interface DeployOptions {
  app: string
  platform?: "local" | "aws" | "gcp" | "azure"
  config?: string
  environmentVariables?: EnvironmentVariable[]
  verbose?: boolean
}

The returned Deployment supports:

  • deployment.url
  • deployment.invokeCommand(name, params, { target? }) — optional target routes to a specific resource by id
  • deployment.setExternalSecret(vault, key, value)
  • deployment.upgrade(options) for cloud mode
  • deployment.destroy()

Configuration

VariableDescriptionDefault
ALIEN_API_KEYPlatform API key for cloud mode—
ALIEN_API_URLPlatform API base URLhttps://api.alien.dev
ALIEN_CLI_PATHPath to the alien binaryauto-detected
VERBOSEShow detailed child-process logsfalse

Notes

  • local mode needs only the alien binary
  • cloud mode needs ALIEN_API_KEY
  • repo-internal low-level tests can still use standalone manager helpers directly; this package is the higher-level product-facing layer

版本与发布记录

@alienplatform/testing 共发布 100 个版本,首次发布于 2026/03/14;过去 12 个月发布了 100 个版本。

版本发布日期距今
3.3.54latest2026/11/051 天前
3.3.532026/11/042 天前
3.3.522026/11/042 天前
3.3.512026/11/042 天前
3.3.502026/11/033 天前
3.3.492026/11/024 天前

其他发布通道:dev → 3.3.42-dev.6e3a661b219b3886d55014b3cef8af0ecdcc65fe。

关于 @alienplatform/testing 的常见问题

@alienplatform/testing 是什么?

Testing framework for Alien applications

如何安装 @alienplatform/testing?

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

@alienplatform/testing 支持 TypeScript 吗?

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

@alienplatform/testing 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@alienplatform/testing 可以商用吗?

@alienplatform/testing 使用 FSL-1.1-Apache-2.0 许可。声明的许可为 FSL-1.1-Apache-2.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@alienplatform/testing 的下载量有多少?

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

@alienplatform/testing 还在维护吗?

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