Karan Kumar
Karan Kumar

Reputation: 3176

Jest - cannot find the tests

I am unable to run my jest test for some weird reason. Am I missing out something here?

I have tried both __test__ & __tests__

Folder structure :

enter image description here

Package.json :


  "scripts": {
    "start": "ts-node-dev --poll src/index.ts",
    "test": "jest watchAll --no-cache"
  },
  "jest": {
    "preset": "ts-jest",
    "testEnvironment": "node",
    "setupFilesAfterEnv": [
      "./src/test/setup.ts"
    ]
  },

Error :

> [email protected] test E:\cultor-microservices\auth
> jest watchAll --no-cache

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In E:\cultor-microservices\auth
  15 files checked.
  testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 1 match
  testPathIgnorePatterns: \\node_modules\\ - 15 matches
  testRegex:  - 0 matches
Pattern: watchAll - 0 matches

Upvotes: 0

Views: 2339

Answers (1)

Karan Kumar
Karan Kumar

Reputation: 3176

This was such a silly mistake, I forgot "--" infront of watchAll in the test script in package.json:

  "scripts": {
    "start": "ts-node-dev --poll src/index.ts",
    "test": "jest --watchAll --no-cache"      // <-- here 
  }

Upvotes: 1

Related Questions