Skip to content

Commit

Permalink
[fix] add test folder to includes (#6085)
Browse files Browse the repository at this point in the history
* [fix] add test folder to includes

Also add some notes to tsconfig/jsonfig
Fixes #5833

* Update packages/create-svelte/shared/+typescript/tsconfig.json

Co-authored-by: Ben McCann <[email protected]>

* Update packages/kit/src/core/sync/write_tsconfig.js

Co-authored-by: Dominik G. <[email protected]>

Co-authored-by: Ben McCann <[email protected]>
Co-authored-by: Rich Harris <[email protected]>
Co-authored-by: Dominik G. <[email protected]>
  • Loading branch information
4 people authored Aug 20, 2022
1 parent 692daed commit 9b24b9c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-lions-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Add notes about includes/excludes and path aliases
5 changes: 5 additions & 0 deletions .changeset/warm-pots-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Add test folder to generated tsconfig
4 changes: 4 additions & 0 deletions packages/create-svelte/shared/+checkjs/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
4 changes: 4 additions & 0 deletions packages/create-svelte/shared/+typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
6 changes: 6 additions & 0 deletions packages/kit/src/core/sync/write_tsconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ export function write_tsconfig(config, cwd = process.cwd()) {
include.push(config_relative(`${relative}/**/*.ts`));
include.push(config_relative(`${relative}/**/*.svelte`));
}
// Test folder is a special case - we advocate putting tests in a top-level test folder
// and it's not configurable (should we make it?)
const test_folder = project_relative('tests');
include.push(config_relative(`${test_folder}/**/*.js`));
include.push(config_relative(`${test_folder}/**/*.ts`));
include.push(config_relative(`${test_folder}/**/*.svelte`));

write_if_changed(
out,
Expand Down

0 comments on commit 9b24b9c

Please sign in to comment.