@adonisjs/vow

中文文档
1.0.17发布于 2018/10/01MITCommonJS近 30 天下载 1.2万

Test runner for Adonis framework with batteries included 🔋

原始使用文档
文档目录9 节
  1. Setup
  2. Concepts
  3. Traits
  4. Suite
  5. Hooks
  6. Context
  7. Development
  8. Release History
  9. Meta

Adonis vow 💂

| Test runner for Adonis framework with batteries included 🔋

NPM Version Build Status Appveyor Coveralls

Adonis vow is the test runner for Adonis framework, just install and register the provider and BOOM it just works.

Setup

adonis install @adonisjs/vow

Read setup instructions

Concepts

The test runner is bare bones that you need to setup and run tests using your command line. But it comes with a powerful concept of traits.

Traits

Traits are building blocks for your tests. Features like Database transactions, Api client, Browser client, they all are built on top of the API provided by traits.

const { trait } = use('Test/Suite')('Sample test suite')

trait((suiteInstance) => {
})

Suite

A test suite is a combination of tests that you want to group inside a single file or group them logically.

Each suite has it's own set of traits, which means adding traits for a single suite, doesn't collides with the other suite :)

Hooks

Each suite has a lifecycle and you can hook into that lifecycle by adding methods to one of the following events.

const suite = use('Test/Suite')('Sample test suite') 

suite.before(() => {
 // executed before the suite
})

suite.after(() => {
 // executed after the suite
})

suite.beforeEach(() => {
 // executed before each test
})

suite.afterEach(() => {
 // executed after each test
})

Context

Each test suite has a context, which is instantiated and passed to each test, so this is the right place to hook stuff that you want to be available to tests.

const { trait, test } = use('Test/Suite')('Sample test suite')

trait((suite) => {
  suite.Context.getter('foo', () => 'bar')
})


test('foo is bar', (ctx) => {
  ctx.assert(ctx.foo, 'bar')
})

// using es6 destructuring
test('foo is bar', ({ foo, assert }) => {
  assert(foo, 'bar')
})

Development

The tests for the test runner are written using japa and make sure to go through the docs.

Release History

Checkout CHANGELOG.md file for release history.

Meta

AdonisJs – @adonisframework – [email protected]

Checkout LICENSE.txt for license information

Harminder Virk (Aman) - https://github.com/thetutlage

版本与发布记录

@adonisjs/vow 共发布 18 个版本,首次发布于 2017/08/25;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.17latest2018/10/018 年前
1.0.162018/07/168 年前
1.0.152018/02/078 年前
1.0.142018/02/018 年前
1.0.132017/10/309 年前
1.0.122017/10/049 年前

关于 @adonisjs/vow 的常见问题

@adonisjs/vow 是什么?

Test runner for Adonis framework with batteries included 🔋

如何安装 @adonisjs/vow?

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

@adonisjs/vow 支持 TypeScript 吗?

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

@adonisjs/vow 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adonisjs/vow 可以商用吗?

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

@adonisjs/vow 的下载量有多少?

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

@adonisjs/vow 还在维护吗?

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