Skip to content

Commit

Permalink
fix(dev): Add placeholder tsconfigs for tests (#5200)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lobsterkatie committed Jun 3, 2022
1 parent 453b7ad commit d48f6fd
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 3 deletions.
8 changes: 8 additions & 0 deletions packages/angular/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/browser/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/core/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/gatsby/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/hub/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/integrations/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/nextjs/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/node-integration-tests/suites/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/node/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/react/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/serverless/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/tracing/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/utils/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/vue/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 8 additions & 0 deletions packages/wasm/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}
8 changes: 5 additions & 3 deletions tsconfig-templates/README.md
@@ -1,5 +1,7 @@
# `tsconfig` Templates

Every package should get its own copy of these three files. Package-specific options should go in `tsconfig.json` and
test-specific options in `tsconfig.test.json`. The `types` file shouldn't need to be modified, and only exists because
tsconfigs don't support multiple inheritence.
Every package should get its own copy of the three files in this directory and the one in `test/` (which should go in an
analogous spot in the package). Package-specific options should go in `tsconfig.json` and test-specific options in
`tsconfig.test.json`. The `types` file shouldn't need to be modified, and only exists because tsconfigs don't support
multiple inheritence. The same goes for the file in `test/`, which only exists because VSCode only knows to look for a
file named (exactly) `tsconfig.json`.
8 changes: 8 additions & 0 deletions tsconfig-templates/test/tsconfig.json
@@ -0,0 +1,8 @@
// TODO Once https://github.com/microsoft/TypeScript/issues/33094 is done (if it ever is), this file can disappear, as
// it's purely a placeholder to satisfy VSCode.

{
"extends": "../tsconfig.test.json",

"include": ["./**/*"]
}

0 comments on commit d48f6fd

Please sign in to comment.