Giter VIP home page Giter VIP logo

test-tube's Introduction

Carbon.io

Travis build status npm Version npm downloads supported node versions MIT License

Carbon.io is an application framework based on Node.js and MongoDB for building command line programs, microservices, and APIs.

With Carbon.io you can create simple, database-centric microservices with virtually no code. At the same time Carbon.io is designed to let you under the hood and allows you to write highly customized APIs much like you would with lower-level libraries such as Express.js.

Quickstart

To install:

$ npm install carbon-io

Copy the following code into service.js:

var carbon = require('carbon-io')

var o  = carbon.atom.o(module).main
var __ = carbon.fibers.__(module)

__(function() {
  module.exports = o({
    _type: carbon.carbond.Service,
    port: 8888,
    endpoints: {
      hello: o({
        _type: carbon.carbond.Endpoint,
        get: function(req) {
          return { msg: "Hello world!" }
        }
      })
    }
  })
})

This will create a Carbon.io service which will respond with "Hello world!" on the /hello endpoint. Run the service with:

$ node service

And test it using:

$ curl localhost:8888/hello

Documentation

Interested in getting started with Carbon.io? Check out our detailed documentation on the Carbon.io website.

Contributing

Interested in contributing to Carbon.io? We love to receive new contributions! There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into Carbon.io itself.

Check out our CONTRIBUTING.md for tips on how to get started!

License

MIT License

test-tube's People

Contributors

benelgar avatar gregbanks avatar tfogo avatar willshulman avatar

Watchers

 avatar  avatar  avatar  avatar

test-tube's Issues

Throwing testtube error within async test creates undefined error.

I have the following code:

asyncWrapper: (fn) => (_, done) => {
    fn()
      .then(() => done())
      .catch((error) => done(error))
  }

module.exports = o.main({
    _type: testtube.Test,
    name: '<TestName>',
    description: '<description>',
    doTest: asyncWrapper(async () => {
      throw new testtube.errors.SkipTestError('Skipping test because prerequisite test failed.')
    }),
})

Whenever the SkipTestError is thrown, I get the following error:

 [*] Test: <TestName> (<description>) (1ms)
TypeError: Cannot read property 'bold' of undefined
    at Test._generateReportHelper (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:788:38)
    at /Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:798:14
    at arrayEach (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/node_modules/lodash/lodash.js:482:11)
    at Function.forEach (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/node_modules/lodash/lodash.js:7767:11)
    at Test._generateReportHelper (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:797:9)
    at /Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:798:14
    at arrayEach (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/node_modules/lodash/lodash.js:482:11)
    at Function.forEach (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/node_modules/lodash/lodash.js:7767:11)
    at Test._generateReportHelper (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:797:9)
    at Test.generateReport (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:743:12)
    at /Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:217:14
    at /Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:500:11
    at __ (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/fibers/index.js:92:13)
    at Test.run (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:498:14)
    at Test.run (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/test-tube/lib/Test.js:212:12)
    at Atom._invokeMain (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/atom/lib/atom.js:631:17)
    at Atom._runMain (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/atom/lib/atom.js:599:12)
    at Atom._makeObject (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/atom/lib/atom.js:192:16)
    at Atom.make (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/atom/lib/atom.js:145:24)
    at Function.o [as main] (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/atom/lib/atom.js:1121:21)
    at /Users/davemccarthy/Repositories/<Project>/front-end/e2e/<TestSuiteName>.js:10:22
    at fiberFunction (/Users/davemccarthy/Repositories/<Project>/node_modules/@carbon-io/fibers/index.js:225:13)
/Users/davemccarthy/Repositories/<Project>/node_modules/fibers/future.js:313
						throw(ex);
						^

Unsure whether or not this has to do with doTest being an async function or not. On test-tube v0.7.4.

Log result status code on assertion error

Below was a case where the statusCode was 204 but it was hard to figure out. The log message logs the response body but not the statusCode. We should add statusCode.

AssertionError: {"name":"PUT /users/:user/contacts/:_id","reqSpec":{"url":"/users/58e018ab12ced6480d801d13/contacts/58e018ab12ced6480d801d14","method":"PUT","headers":{"Authorization":"Basic Ym9iYnlAam9uZXMuY29tOnJhaW5ib3c="},"body":{"_id":"58e018ab12ced6480d801d14","firstName":"Mary","lastName":"Smith","email":"[email protected]","phoneNumbers":{"mobile":"415-555-5555"}}},"resSpec":{"statusCode":200}} Response body: undefined

Add ability to configure common headers in HttpTest

Specifying a common header in every request can be a bit arduous (e.g. an API key). It would be nice to be able to specify a set of headers that will get automatically added to all requests in an HttpTest.

Make last line of output a summary of test results

If there is a lot of output sometimes a failing test can be hidden in the scrollback. It can also be useful to know how many tests, passed, failed and especially how many were skipped. Maybe something like the following:

TEST FAILED: 114 tests run. 109 passed. 3 failed. 2 skipped.

Add option to specify assertion type for result

It would be nice to be able to specify some, possibly inheritable, property that defined how a body in a resSpec should be tested for equality with the expected object body. I think the default is to use assert.deepEqual but it would be nice to be able to specify a more permissive assertion.

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.