Skip to content

no-import-test-files considers test/helpers/index.js a test file #311

Open
@fregante

Description

@fregante

From my understanding, `/helpers/ are not test files: https://github.com/avajs/ava/blob/1222ce9538e4890c20af695e558e3ee490f5a41b/docs/05-command-line.md#cli

And should pass: https://github.com/avajs/eslint-plugin-ava/blob/7542453058c30ebbc79c7bfeb689492fce226d8f/docs/rules/no-import-test-files.md

But they don't:

Setup

node/14.4.0
npm/6.14.5

repro.zip

{
  "private": true,
  "scripts": {
    "test": "xo && ava"
  },
  "devDependencies": {
    "ava": "^3.12.1",
    "xo": "^0.33.1"
  }
}
// test/helpers/index.js;
exports.USER = { login: "current-user" };
// test/index.js
const test = require("ava");
const { USER } = require("./helpers");

test.cb("Help me help you", (t) => {
  console.log(USER);
  t.end();
});

Output

❯ xo

  test/index.js:2:16
  ✖  2:16  Test files should not be imported.  ava/no-import-test-files

  1 error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions