Setting up a typescript compile scope to exclude `__tests__` folder from being compiled doesn't work.

All of my tests are written in typescript. They are stored in the __tests__ folder. I use jest and ts-jest to run the tests so I don't need Webstorm to compile those test scripts into js/jsx for me.

My aims:

1. Exclude  __tests__ and __tests__util from being compiled 

2. Make sure the type_src folder that stores all the main project ts codes are compiled. 

I've found that the only way to get it work is making two settings:

1. Set up a compile scope pattern in `Language > Frameworks > Typescript` to exclude __tests__ and __tests__util recursively and include type_src recursively:


2. adding__tests__ and __tests__util to the `exclude property` in tsconfig.json

My question is, is it the correct way of excluding those folders from compiling? I thought just setting up the compile scope in Webstorm would work, but I don't understand why  I have to update the tsconfig.json as well.

Folder structure:

-- project
-- __tests__
-- __tests__util
-- node_modules
-- src <<-- js output
-- type_src
-- tsconfig.json
-- package.json



"compilerOptions": {
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"experimentalDecorators": true,
"noLib": false,
"declaration": false,
"emitDecoratorMetadata": true,
"lib": ["es6", "dom"],
"types": ["reflect-metadata"],
"skipLibCheck": true,
"outDir": "./src",
"jsx": "preserve"
"exclude": [

Comment actions Permalink

No need to specify test patterns... I'd suggest excluding "__tests__" from the root tsconfig.json, adding a separate tsconfig.json to __tests__ folder, with

"compileOnSave": false
Comment actions Permalink

Hi Elena,

I have created a ticket with a demo repository. I can't get it to work. It looks like the WebStorm compiler is stubborn at compiling all of my ts files in __tests__ even though there's a tsconfig that specifies "compileOnSave":false in __tests__

Comment actions Permalink

thanks, reproduced

Comment actions Permalink

please see the developer's comment in the ticket - you should have excluded __tests__ from the root config per my suggestion in


Please sign in to leave a comment.