Skip to content

test.cb does not timeout #1126

Closed
Closed
@gajus

Description

@gajus

Description

I am using test.cb callback to define an asynchronous test. My test is failing (the expected callback is not called).

Current behaviour

This leaves the entire test suite hanging indefinitely.

Expected behaviour

Expect the test to fail after some X time.

Test Source

test.cb.only('togglePushdown', (t) => {
  console.log('A 0');

  const div = document.createElement('div');

  console.log('A 1');

  div.id = 'pushdown';

  document.body.appendChild(div);

  console.log('A 2');

  const origAnimate = minidom.animate;

  minidom.animate = (...args) => {
    console.log('A 5');

    t.deepEqual(args[1], {
      height: 250
    });

    minidom.animate = origAnimate;

    t.end();
  };

  console.log('A 3');

  AdsManager.togglePushdown();

  console.log('A 4');
});

This produces:

A 0
A 1
A 2
A 3
A 4

Error Message & Stack Trace

None. The test is just hanging.

Config

Copy the relevant section from package.json:

{
  "ava": {
    "require": [
      "babel-register"
    ],
    "babel": "inherit"
  }
}

Command-Line Arguments

Copy your npm build scripts or the ava command used:

ava --verbose --serial --fail-fast --watch ./test/AdsManager.js

Environment

Tell us which operating system you are using, as well as which versions of Node.js, npm, and AVA. Run the following to get it quickly:

$ node -e "var os=require('os');console.log('Node.js ' + process.version + '\n' + os.platform() + ' ' + os.release())"
$ ava --version
$ npm --version
Node.js v7.1.0
darwin 16.1.0
0.17.0
4.0.2

Side note

It would be a useful addition if the DEBUG=* logged which tests it is entering/ leaving to help debug issues such as this one. Now if the test is set to only I am not getting any output unless there is a console.log in the script itself.

$ DEBUG=* ava --verbose --serial --fail-fast --watch ./test/AdsManager.js
ava ipc stats:
{ testCount: 1, hasExclusive: true, file: 'test/AdsManager.js' } +0ms
A 0
A 1
A 2
A 3
A 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions