From d48f6fd79d4d860264868b6ae653cd902c87cd14 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Fri, 3 Jun 2022 12:35:06 -0700 Subject: [PATCH] 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] mseag/bible-karaoke#175 [6] microsoft/TypeScript#8435 [7] microsoft/TypeScript#33094 --- packages/angular/test/tsconfig.json | 8 ++++++++ packages/browser/test/tsconfig.json | 8 ++++++++ packages/core/test/tsconfig.json | 8 ++++++++ packages/gatsby/test/tsconfig.json | 8 ++++++++ packages/hub/test/tsconfig.json | 8 ++++++++ packages/integrations/test/tsconfig.json | 8 ++++++++ packages/nextjs/test/tsconfig.json | 8 ++++++++ packages/node-integration-tests/suites/tsconfig.json | 8 ++++++++ packages/node/test/tsconfig.json | 8 ++++++++ packages/react/test/tsconfig.json | 8 ++++++++ packages/serverless/test/tsconfig.json | 8 ++++++++ packages/tracing/test/tsconfig.json | 8 ++++++++ packages/utils/test/tsconfig.json | 8 ++++++++ packages/vue/test/tsconfig.json | 8 ++++++++ packages/wasm/test/tsconfig.json | 8 ++++++++ tsconfig-templates/README.md | 8 +++++--- tsconfig-templates/test/tsconfig.json | 8 ++++++++ 17 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 packages/angular/test/tsconfig.json create mode 100644 packages/browser/test/tsconfig.json create mode 100644 packages/core/test/tsconfig.json create mode 100644 packages/gatsby/test/tsconfig.json create mode 100644 packages/hub/test/tsconfig.json create mode 100644 packages/integrations/test/tsconfig.json create mode 100644 packages/nextjs/test/tsconfig.json create mode 100644 packages/node-integration-tests/suites/tsconfig.json create mode 100644 packages/node/test/tsconfig.json create mode 100644 packages/react/test/tsconfig.json create mode 100644 packages/serverless/test/tsconfig.json create mode 100644 packages/tracing/test/tsconfig.json create mode 100644 packages/utils/test/tsconfig.json create mode 100644 packages/vue/test/tsconfig.json create mode 100644 packages/wasm/test/tsconfig.json create mode 100644 tsconfig-templates/test/tsconfig.json diff --git a/packages/angular/test/tsconfig.json b/packages/angular/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/browser/test/tsconfig.json b/packages/browser/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/core/test/tsconfig.json b/packages/core/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/gatsby/test/tsconfig.json b/packages/gatsby/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/hub/test/tsconfig.json b/packages/hub/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/integrations/test/tsconfig.json b/packages/integrations/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/nextjs/test/tsconfig.json b/packages/nextjs/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/node-integration-tests/suites/tsconfig.json b/packages/node-integration-tests/suites/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/node/test/tsconfig.json b/packages/node/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/react/test/tsconfig.json b/packages/react/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/serverless/test/tsconfig.json b/packages/serverless/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/tracing/test/tsconfig.json b/packages/tracing/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/utils/test/tsconfig.json b/packages/utils/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/vue/test/tsconfig.json b/packages/vue/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/packages/wasm/test/tsconfig.json b/packages/wasm/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +} diff --git a/tsconfig-templates/README.md b/tsconfig-templates/README.md index faab3d4983f8..8c007dcbb7c2 100644 --- a/tsconfig-templates/README.md +++ b/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`. diff --git a/tsconfig-templates/test/tsconfig.json b/tsconfig-templates/test/tsconfig.json new file mode 100644 index 000000000000..074ceb45a9db --- /dev/null +++ b/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": ["./**/*"] +}