GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Asynchronous test in mocha · Issue #295 · feup-infolab/dendro

Asynchronous test in mocha #295

New issue
Copy link
New issue
Copy link
Open
Open
Asynchronous test in mocha#295
Copy link
Labels
Low Prioritybug

Description

@silvae86
silvae86
opened on Nov 24, 2017
Issue body actions

All assertions inside the HTTP call callbacks need to be wrapped in try-catch blocks that call done(error), because at this time if there is a

res.status.should.equal(200)

inside a callback for a REST api call, the whole test suite will die. If we catch the error and call done(error), only the failed test case will be failed and others will continue.

Example:

OK

createProjectsUnit.setup(function (err, res)
        {
            try{
                should.equal(err, null);
            }
            catch(e)
            {
                done(err);
            }
        });

NOT OK

createProjectsUnit.setup(function (err, res)
        {
            should.equal(err, null); // this will throw an uncaught Error, effectively crashing the test suite before calling done().
            done();
        });

Activity

  1. silvae86
    added a commit that references this issue on Nov 24, 2017

    Commented CKAN deposit tests for now

    7c464dc
  2. silvae86 commented on Nov 26, 2017

    @silvae86
    silvae86
    on Nov 26, 2017
    MemberAuthor
    More actions

    Found a good alternative, niftylettuce/check-chai, allows you to do this:

                chai.check(done, function ()
                {
                    should.equal(err, null);
                });

    We need to write a piece of code to make the replacements on our tests.

  3. silvae86
    added
    bug
    Low Priority
    on Dec 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Low Prioritybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.