Skip to content

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

@revelt

Description

@revelt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions