Skip to content

Commit d48f6fd

Browse files
authored
fix(dev): Add placeholder tsconfigs for tests (#5200)
It is well-documented (see 1-6 below) that VSCode doesn't support setups like ours, where multiple tsconfig files coexist in a single directory. Strangely, though, it is only recently that this has become a problem, with VSCode at random intervals forgetting that it's ever heard of `expect` or `describe` (because it's not seeing `tsconfig.test.json`, but taking a while to realize it). There is an open issue[7] tracking the addition of support for this, but it's been open for a long time, with little movement. In the meantime, this solves the problem by adding placeholder `test/tsconfig.json` files to each package, each pointing to its corresponding `tsconfig.test.ts` file. I went with this approach over simply moving and renaming the existing test tsconfigs because this allows us to stay consistent in having all flavors of tsconfig for a package live at the package root level, and provides an easy way to reverse this workaround, should VSCode ever fix the underlying problem. [1] angular/angular-cli#5175 [2] microsoft/TypeScript#49210 [3] microsoft/vscode#107750 [4] microsoft/vscode#12463 [5] sillsdev/bible-karaoke#175 [6] microsoft/TypeScript#8435 [7] microsoft/TypeScript#33094
1 parent 453b7ad commit d48f6fd

File tree

17 files changed

+133
-3
lines changed

17 files changed

+133
-3
lines changed

packages/angular/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/browser/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/core/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/gatsby/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/hub/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/nextjs/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/node/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/react/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/tracing/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/utils/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/vue/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

packages/wasm/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

tsconfig-templates/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# `tsconfig` Templates
22

3-
Every package should get its own copy of these three files. Package-specific options should go in `tsconfig.json` and
4-
test-specific options in `tsconfig.test.json`. The `types` file shouldn't need to be modified, and only exists because
5-
tsconfigs don't support multiple inheritence.
3+
Every package should get its own copy of the three files in this directory and the one in `test/` (which should go in an
4+
analogous spot in the package). Package-specific options should go in `tsconfig.json` and test-specific options in
5+
`tsconfig.test.json`. The `types` file shouldn't need to be modified, and only exists because tsconfigs don't support
6+
multiple inheritence. The same goes for the file in `test/`, which only exists because VSCode only knows to look for a
7+
file named (exactly) `tsconfig.json`.

tsconfig-templates/test/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
2+
// it's purely a placeholder to satisfy VSCode.
3+
4+
{
5+
"extends": "../tsconfig.test.json",
6+
7+
"include": ["./**/*"]
8+
}

0 commit comments

Comments
 (0)