0

I am running ava with ts-node with the following config:

"ava": {
    "files": [
        "tests/**/*",
        "!test/exclude-files-in-this-directory",
        "!**/exclude-files-with-this-name.*"
    ],
    "failFast": true,
    "failWithoutAssertions": false,
    "extensions": [
        "spec.ts",
        "ts"
    ],
    "environmentVariables": {
        "NODE_ENV": "test"
    },
    "require": [
        "ts-node/register",
        "tsconfig-paths/register"
    ],
    "tap": false,
    "verbose": true
}

The problem is that .spec.ts files don't get recognized, as ts-node is doing some kind of conversion (I think) of the .spec.ts files into just .ts, which means that the extension with spec.ts is never matched.

Here's the output of the tests

  - graphql › stage-2 › workspace.ts › do later
  ✔ general › functions.ts › returns proper difference

The files are named workspace.spec.ts and functions.spec.ts

Is there anyway for ts-node to not drop the spec part?

A. L
  • 11,695
  • 23
  • 85
  • 163

1 Answers1

0

ts-node should only kick in when AVA requires the test file. I can't immediately spot why this isn't working. Are those spec.ts files inside the tests directory?

P.S. NODE_ENV already defaults to test, and you don't need to disable tap either.

Mark Wubben
  • 3,329
  • 1
  • 19
  • 16