jeudi 27 août 2020

Error home.component.spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property

When running ng test I get the following error home.component.spec.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

Project structure

Project/
|-- src/
|   |-- app/
|   |   |-- home/
|   |   |   |-- home.component.spec.ts  
|   |   |-- app-main.component.spec.ts
|   |-- test.ts
|   |-- tsconfig.spec.json
|-- angular.json
|-- package.json
|-- tsconfig.json

tsconfig.spec.json

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/spec",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts",
    "polyfills.ts",
    "app/app-main.component.spec.ts" // explicitly targetting spec.ts file works, but I want to add them to the include property
  ],
  "include": [
    "**/*.spec.ts", // can't find app/app-main.component.spec.ts
    "**/**/*.spec.ts", // can't find app/home/home.component.spec.ts
    "app/*.spec.ts", // can't find app/app-main.component.spec.ts
    "**/*.d.ts"
  ]
}

It works only when I Add the spec files explicitly, I want to add those files/directory's to the include block so I don't need to explicitly add the spec files one by one.

Aucun commentaire:

Enregistrer un commentaire