vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.76k stars 6.33k forks source link

Separate tsconfig.json for src and test/unit folders #5858

Open Mikilll94 opened 4 years ago

Mikilll94 commented 4 years ago

What problem does this feature solve?

When scaffolding a new project using vue-cli it would be nice to have a separate tsconfig.json file for "src" and "test/unit" folders.

Because right now there is one tsconfig.json file which shares the TypeScript configuration both for unit tests and application code.

Thanks to that feature, we wouldn't need to i.e. import Jest type in the application tsconfig.json.

What does the proposed API look like?

When scaffolding a new project there should a separate tsconfig.json for app code and unit tests.

As an example, Vuetify uses multiple tsconfig.json

TheDutchCoder commented 3 years ago

I second this for the following reason: we keep our tests next to their respective components, instead of in the /tests folder, as this is a pretty common practice in larger code bases.

However, TypeScript will ignore ts files in __tests__ folders, unless you specifically configure it.