简体   繁体   English

开玩笑 - 找不到测试

[英]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__我试过 __test__ 和 __tests__

Folder structure :文件夹结构

在此处输入图片说明

Package.json :包.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 :错误

> auth@1.0.0 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

This was such a silly mistake, I forgot "--" infront of watchAll in the test script in package.json :这是一个如此愚蠢的错误,我在package.json的测试脚本中忘记了 watchAll 前面的“--”:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM