Giter Club home page Giter Club logo

adonis-vow's Introduction

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

adonis-vow's People

Contributors

diego3g avatar erikkallen avatar radmen avatar romainlanz avatar thetutlage avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.