Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface errors in loading the test file, rather than misleadingly stating there are no tests #2290

Closed
revelt opened this issue Nov 7, 2019 · 3 comments
Labels
bug current functionality does not work as desired help wanted scope:reporters

Comments

@revelt
Copy link

revelt commented Nov 7, 2019

Description

Currently, if anything in the test's dependency tree is missing, AVA gives a message "no tests found in ":

Screen Shot 2019-11-07 at 05 45 39

Let's make this message more meaningful!

From a user's perspective, it's very frustrating because one has to manually go through all dependencies and often it's a typing error or wrong way the API is consumed which makes it even harder to spot what's missing. ESLint plugins like no-unresolved don't help either. It's very easy to mis-wire the own API and not to trigger ESLint.

When such error happens, there must be a real error message somewhere deep, probably it is just not "piped through" to the end-user though AVA's innards. Maybe it's esm or between the AVA and its dependencies?

Often people encounter this like in #1903 and Support here helps to pinpoint the missing dependency but we should do something at the higher level to make the messages more meaningful so that users could help themselves. And save everybody's time.

Test Source

Make a dependency not to be resolved one way or another.

test file:

import test from "ava";
import {something} from "package1";
test("01", t => {
t.pass("just pass");
})

just make it so that "package1" does not export "something", and you'll get this error "no tests found in ".

Config

I'm using esm and my sources are in ES modules, if it matters.

From package.json:

  "ava": {
    "cache": false,
    "compileEnhancements": false,
    "require": [
      "esm"
    ],
    "timeout": "99m",
    "verbose": true
  },
  "esm": {
    "await": true,
    "cjs": true
  },

Environment

MacOS and ava 2.4.0

@novemberborn novemberborn added bug current functionality does not work as desired help wanted labels Nov 10, 2019
@novemberborn novemberborn changed the title Feature request — Improve the messaging during error "no tests found in ..." Surface errors in loading the test file, rather than misleadingly stating there are no tests Nov 10, 2019
@novemberborn
Copy link
Member

Thanks for raising this @revelt.

@kleinfreund
Copy link

kleinfreund commented Mar 14, 2020

In the meantime, how do people find out what’s actually going wrong?

I upgraded a project’s ava version to 3.5.0 (including the major version change to version 3.0.0). That project is importing a module from a .ts file via ts-node/register. Now, I get "Couldn't find any files to test" even though I have tests.

What works for my particular case is installing @ava/babel and adding the following configuration to the ava key in my package.json:

    "babel": {
      "compileEnhancements": false
    },

@novemberborn
Copy link
Member

Both due to the age of this issue, and the state of our reporters, I've decided to roll this into #2501.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug current functionality does not work as desired help wanted scope:reporters
Projects
None yet
Development

No branches or pull requests

3 participants