Code Monkey home page Code Monkey logo

alola's Issues

open points

  • custom assertion doc
  • logo
  • screenshot
  • license

baretest pr

const rgb = require('barecolor')

module.exports = function(headline) {
  const suite = [],
    before = [],
    after = [],
    only = []

  function self(name, fn) {
    suite.push({ name: name, fn: fn })
  }

  self.only = function(name, fn) {
    only.push({ name: name, fn: fn })
  }

  self.before = function(fn) { before.push(fn) }
  self.after = function(fn) { after.push(fn)  }
  self.skip = function(fn) {}

  // for testing Baretest
  self.run = async function() {
    const tests = only[0] ? only : suite

    rgb.cyan(headline + ' ')
    const failed = [];

    for (const test of tests) {
      try {
        for (const fn of before) await fn()
        await test.fn()
        rgb.gray('• ')

      } catch(e) {
        for (const fn of after) await fn()
        rgb.red('• ')
        failed.push(()=>{
           rgb.red(`\n\n! ${test.name} \n\n`)
           prettyError(e)
         });
        continue
      }
    }

    for (const fn of after) await fn()

    if (failed.length === 0){
      rgb.greenln(`✓ ${ tests.length }`)
      console.info('\n')
      return true
    }

    failed.forEach(fn => fn());
    rgb.redln(`x ${ failed.length } of ${tests.length}`)
    return false;
  }

  return self

}


function prettyError(e) {
  const msg = e.stack
  if (!msg) return rgb.yellow(e)

  const i = msg.indexOf('\n')
  rgb.yellowln(msg.slice(0, i))
  rgb.gray(msg.slice(i))
  console.info('\n')
}

setup CD with github actions

  • pull_request to master (workflow: pull-request.yml)

    • npm ci
    • npm run test
    • release-it --dry-run
  • on master release-publish.yml

    • npm ci
    • npm run test
    • release-it

[backlog]

  • NO_COLOR vs tty
  • Docu rewrite
  • Logo (re)design

broken assertions

image

Steps to reproduce:

docker run -it node:alpine sh

# inside docker container
apk add --update git curl

curl -Lis http://krautipsum.com/api/noun | npx -q https://github.com/balazs4/alola#master 'status should be 200'

property-based-testing

alola curl -H 'auth: xxxx' http://fake.api/create/<name> -XPOST -- \
  'name should get string' \
  'status should be 201'

/cc @chubin

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.