简体   繁体   中英

Typescript: how to disable spec.ts file generation?

i'm developing an Angular2 app with Typescript and every time i run the Typescript transpiler it creates spec.ts files. They are unit tests for the source files because the convention for Angular2 applications is to have this file for each .ts file.

Since at the moment i don't want to do any test, i would like to temporaly disable the generation of spec.ts files, that are a bit messy to handle with my source files.

Do you know how to do that?

EDIT: here is my tsconfig.json file:

{
    "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "dist",
    "rootDir": "./src",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "moduleResolution": "node"
  },
  "exclude": [
    "typings/main.d.ts",
    "typings/main",
    "node_modules"
  ]
}

You can configure your tsconfig.json file to achieve this. You can specify which files to compile by adding them to the files array or you can tell typescript to exclude a certain file or folder by including it in the exclude array.

Here is the link from the official docs.

But as far as i can tell you can't provide a patter like so: '/**.spec.ts'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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