mtiller / ts-jest-sample

A sample repo leveraging TypeScript, jest and ts-jest (with code coverage and debugging)
160 stars 59 forks source link

Don't compile tests #12

Open qm3ster opened 5 years ago

qm3ster commented 5 years ago

This compiles __tests__ into lib as well. I'd like to only compile src. But as soon as I add "include": ["src"] to tsconfig.json, It stops applying that config to the tests VS Code. What to do?

qm3ster commented 5 years ago

Solved for the moment by having a separate config for release: tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "target": "es6",
    "module": "commonjs",
    "lib": ["es2017"],
    "resolveJsonModule": true,
    "noFallthroughCasesInSwitch": true,
    "noEmit": true
  },
  "exclude": ["dist"]
}

tsconfig.release.json

{
  "extends": "./tsconfig",
  "compilerOptions": {
    "noEmit": false,
    "outDir": "dist",
    "declaration": true
  },
  "include": ["src"],
  "exclude": ["**/*.spec.ts"]
}

package.json

  "scripts": {
    "prepare": "tsc -p ./tsconfig.release.json"
  }