Détail du package

@adonisjs/vow

adonisjs9.7kMIT1.0.17

Test runner for Adonis framework with batteries included 🔋

readme

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 – virk@adonisjs.com

Checkout LICENSE.txt for license information

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

changelog

1.0.17 (2018-10-01)

Features

  • assert: assert cookie exists (#28) (0d99590)
  • runner: allow customer reporters via runner.reporter (1350106)

1.0.16 (2018-07-16)

Features

  • test: add test.failing and test.skip methods (e42621b)

1.0.15 (2018-02-07)

1.0.14 (2018-02-01)

Bug Fixes

  • instruction: typo (#3) (bf855dd)
  • runtest: accept and format timeouts properly (2952d39), closes #10

Features

  • cli: extend glob to cover subdirectories (cce2055)
  • response: add assertSee (#7) (0cf627f)

1.0.13 (2017-10-29)

Bug Fixes

  • instruction: typo (#3) (bf855dd)
  • runtest: accept and format timeouts properly (2952d39), closes #10

Features

1.0.12 (2017-10-03)

Features

  • api-request: add accept method (de6c0f2)

1.0.11 (2017-09-26)

Bug Fixes

  • make:test: keep suite name human readable (03105fc)
  • suite: suite.timeout(0) should work fine (9623f79)

1.0.10 (2017-09-25)

Bug Fixes

  • make:test: fix casing issue (bbd7a32)

1.0.9 (2017-09-24)

Bug Fixes

  • command: fix chioce to choice typo (00f0674)
  • command: fix failing tests (a7fff34)

1.0.8 (2017-09-16)

1.0.7 (2017-09-14)

1.0.6 (2017-09-14)

Features

  • groups: add concept of groups in tests (ee08478)

1.0.5 (2017-09-08)

Features

  • response: attach error prop when exists (8ee7b92)

1.0.4 (2017-08-29)

Bug Fixes

  • api-response: throw error happen out of request lifecycle (e4c35c3)
  • cookieParser: ensure value is string before calling trim (132f433)
  • runner,vowfile: fix typos (08fdb0e)

1.0.3 (2017-08-29)

Features

  • command: add make:test command (5ba0a85)

1.0.2 (2017-08-29)

Features

  • api-client: implement api-client (1e5edd1)
  • api-response: add api client response (893471b)
  • request: add base request class (e50291f)
  • request: support for adding headers (2659ee6)
  • response: add base response class (805be5a)

1.0.1 (2017-08-25)

Bug Fixes

  • command: fix typo for pathExists method (ceee8de)

1.0.0 (2017-08-25)

Bug Fixes

  • api: throw hard rejection from api client (e4940cd)
  • command: change flag t- to -t and kill process (14da415)
  • command: inject server binding (436e560)
  • provider: pull adonis/ace over adonis/fold (c6cf286)

Features

  • implement suite and test runner (831b174)
  • that fat commit (d14f0bc)
  • command: expose runner and cli via vowfile.js (33e3543)
  • command: register command on boot (a9da0f6)
  • command: start http server when running test (2c1b68d)
  • context: add support for context that is passed to tests (12f7303)
  • instructions: add instructions files (fcd733c)
  • response: add assertions to client response (05794bc)