Search code examples
angulartypescripttsconfig

What does tsconfig.spec.json do?


I have seen this and this posts and they have made me understand tsconfig.app.json and tsconfig.json.

I have an angular app which has tsconfig.app.json, tsconfig.json and tsconfig.spec.json

What is the role of tsconfig.spec.json? What does the 'spec' in tsconfig.spec.json stand for?


Solution

  • It is TypeScript configuration for the application tests.

    For example below code you says

    "types": ["jasmine", "node"]
    

    I will use jasmine for testing on nodejs environment.

    {
      "extends": "../tsconfig.json",
      "compilerOptions": {
        "outDir": "../out-tsc/spec",
        "module": "commonjs",
        "target": "es5",
        "baseUrl": "",
        "types": [
          "jasmine",
          "node"
        ]
      },
      "files": [
        "test.ts",
        "polyfills.ts"
      ],
      "include": [
        "**/*.spec.ts",
        "**/*.d.ts"
      ]
    }