avajs / karma-ava

Karma plugin for AVA
https://ava.li
MIT License
63 stars 6 forks source link

Errors that occur in the test files, but outside AVA's tests are silently being ignored #5

Open niieani opened 8 years ago

niieani commented 8 years ago
24 08 2016 19:07:28.510:ERROR [plugin]: Error during loading "karma-ava" plugin:                  
  Cannot find module 'ava/lib/prefix-title'    

EDIT: See the comment below for full context.

sindresorhus commented 8 years ago

The required AVA changes (https://github.com/avajs/ava/commit/204f2be2e8f174f698a56d504a0a6c76a1e0b60f) have not yet been published. You'll have to wait for the next AVA version or install from GitHub npm install --save-dev avajs/ava#204f2be2e8f174f698a56d504a0a6c76a1e0b60f.

niieani commented 8 years ago

Ah, I thought this was already released since it's merged into master. However, once installing I get the following result:

24 08 2016 20:52:49.231:INFO [karma]: Karma v1.2.0 server started at http://localhost:9879/       
24 08 2016 20:52:49.231:INFO [launcher]: Launching browser Chrome with unlimited concurrency      
24 08 2016 20:52:49.245:INFO [launcher]: Starting browser Chrome                                  
24 08 2016 20:52:51.765:INFO [Chrome 54.0.2837 (Mac OS X 10.11.6)]: Connected on socket /#sNq5O7lB2Owtytm7AAAA with id 90860148                                                                     
24 08 2016 20:53:01.769:WARN [Chrome 54.0.2837 (Mac OS X 10.11.6)]: Disconnected (1 times), because no message in 10000 ms.                                                                         
Chrome 54.0.2837 (Mac OS X 10.11.6) ERROR                                                         
  Disconnected, because no message in 10000 ms.                                                   

Chrome 54.0.2837 (Mac OS X 10.11.6) ERROR                                                         
  Disconnected, because no message in 10000 ms.                                                   
Chrome 54.0.2837 (Mac OS X 10.11.6) ERROR                                                         
  Disconnected, because no message in 10000 ms.                                                   

Chrome 54.0.2837 (Mac OS X 10.11.6): Executed 0 of 0 DISCONNECTED (10.006 secs / 0 secs)    
sindresorhus commented 8 years ago

You might need to install master here too, as there are some unreleased changes. I haven't even tried out this module yet. It's very much a work in progress. We'll work on it more in a couple of weeks when @jamestalmage is back.

niieani commented 8 years ago

Actually, I've found out what's causing the problem. It seems that any errors that occur outside AVA's tests are silently being ignored. I'll give you an example:

import test from 'ava';
import a from 'a'; // failing import here!

test(function (t) {
    t.is('foo', 'foo');
});

When I make the import into a require and nest it inside the test, it works (i.e. I get the proper error):

import test from 'ava';

test(function (t) {
    require('a'); // failing import here!
    t.is('foo', 'foo');
});

So I guess what could be done is the whole AVA context should be somehow wrapped in a try/catch block, so we get a meaningful error instead of nothing (i.e. Disconnected, because no message in 10000 ms.).

sindresorhus commented 8 years ago

So I guess what could be done is the whole AVA context should be somehow wrapped in a try/catch block, so we get a meaningful error instead of nothing (i.e. Disconnected, because no message in 10000 ms.).

Agreed