@harnessed-ts/core

中文文档
0.8.2发布于 2026/11/15MITTypeScriptESM + CJS零依赖近 30 天下载 4656

Component harnesses that run under any test driver — the driver-free core.

原始使用文档

@harnessed-ts/core

The driver-free core: Query, Selector, ComponentHarness, the decorators, the driver registry, configure(), the matcher implementations, and the Vite and Babel plugins and Node and Bun loaders that lower standard decorators.

Depends on no driver. Install a driver alongside it — @harnessed-ts/dom or @harnessed-ts/playwright.

// tsconfig.json — the three options decorators need
{ "extends": "@harnessed-ts/core/tsconfig.json" }
// vite.config.ts / vitest.config.ts — the transform they need
import { harnessedDecorators } from '@harnessed-ts/core/vite'
export default defineConfig({ plugins: [harnessedDecorators(), react()] })
// babel.config.cjs — an app whose own decorators are legacy (Ember)
plugins: [require.resolve('@harnessed-ts/core/babel') /* , …the app's plugins */]
# node:test — strips types, lowers decorators and compiles JSX with esbuild
node --test --import @harnessed-ts/core/register
# bunfig.toml — bun test, whatever experimentalDecorators the tsconfig sets
[test]
preload = ["@harnessed-ts/core/bun"]

Full guide, the cross-driver guarantees, and the API: the harnessed README.

MIT © Joe Gaudet, Jay Seo

版本与发布记录

@harnessed-ts/core 共发布 7 个版本,首次发布于 2026/09/06;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.8.2latest2026/11/152 天前
0.8.12026/11/0512 天前
0.8.02026/11/0512 天前
0.7.02026/10/3118 天前
0.6.02026/10/2820 天前
0.3.02026/09/251 个月前

关于 @harnessed-ts/core 的常见问题

@harnessed-ts/core 是什么?

Component harnesses that run under any test driver — the driver-free core.

如何安装 @harnessed-ts/core?

在项目目录运行 npm install @harnessed-ts/core,或使用 pnpm add / yarn add / bun add。

@harnessed-ts/core 支持 TypeScript 吗?

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

@harnessed-ts/core 支持 ESM 还是 CommonJS?

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

@harnessed-ts/core 需要什么版本的 Node.js?

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

@harnessed-ts/core 可以商用吗?

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

@harnessed-ts/core 的下载量有多少?

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

@harnessed-ts/core 还在维护吗?

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